Version 4.2.6 for Mainframes
 —  Operations  —

Natural 3GL CALLNAT Interface - Purpose, Prerequisites, Restrictions

This document describes the purpose of the 3GL CALLNAT interface and its prerequisites and restrictions.

The following topics are covered:


Purpose of 3GL CALLNAT Interface

With the 3GL CALLNAT interface, Natural enables 3GL programs to invoke and execute Natural subprograms.

The 3GL can be any programming language which supports the standard linkage call interface. In most cases this will be a COBOL program, but the functionality can also be used by, for example, PL/1, FORTRAN, C or Assembler programs.

Under CMS, Natural provides the function CALLNAT to execute Natural subprograms from a Rexx program. For details, refer to Natural under VM/CMS.

Availability

The interface is available in batch mode under the following operating systems:

and for the following TP-monitor environments:

Top of page

Prerequisites

This section describes the prerequisites to execute a Natural subprogram from a 3GL program, using an internal CALLNAT statement To achieve the desired functionality, a Natural environment must be set up before you execute the CALLNAT interface from your 3GL program.

Space Requirements

The mechanism of parameter addressing in a Natural program requires that the parameters passed reside in an area allocated by Natural, that is, in any of its sizes. The 3GL program, however, allocates the storage for its variables somewhere in the address space of the task. To make addressing still successful, a "call-by-value" mechanism is used for those variables which do not already reside in a Natural area. This means that, prior to invoking the Natural subprogram, the parameters to be passed are transferred into a Natural area, namely the DATSIZE buffer.

In addition to the storage used for the contents of the variables, additional storage will be needed depending on the number of parameters. The total amount of space required is approximately the same as the space that would be needed in the DATSIZE buffer if the subprogram-invoking program were coded in Natural.

Linking

To invoke the Natural subprogram, the 3GL program must call the CALLNAT interface. Depending on the power and functionality of the call interface of the 3GL programming language, the CALLNAT interface can be either placed in an accessible load library for dynamic loading or linked to the 3GL program. In most cases, it is neccessary to link the 3GL program to the interface module (for example, NATXCAL; see below).

The samples XNATGC2 and XNATGCP2 are provided to elucidate the technique of dynamically loading and calling the CALLNAT interface from COBOL or PL/I, respectively.

Note:
Check with the responsible system programmer for the best solution in your environment.

Environment Dependencies

The foreign 3GL module can be either linked to Natural as a CSTATIC module and then invoked via a branch and link instruction, or loaded dynamically and invoked via a TP-dependent link method.

In the latter case, the 3GL module is written in a TP-specific way and the CALLNAT interface must be adapted accordingly. For this purpose, multiple TP-specific interface modules are provided:

NATXCAL To be used if the 3GL module is either linked to Natural or loaded dynamically and then invoked by a branch and link instruction (batch, CMS, Com-plete, IMS TM, TIAM, TSO, UTM).
NATXCAL4 To be used if the 3GL module is called via the INTERFACE4 option of the CALL statement. It provides the INTERFACE4 Natural Callnat Interface as well as the INTERFACE4 Callback Functions. For further information on the INTERFACE4 functionality, see the CALL statement documentation
NCIXCALL To be used in a CICS environment if the 3GL module has been invoked using EXEC CICS LINK; NCIXCALL is delivered in source code to be compiled with your CICS macros. See also Installing the Natural CICS Interface in the Natural Installation documentation.
NCIXCPRM To be used in a CICS environment to build the parameter address list used as COMMAREA for the subsequent EXEC CICS LINK command.

Top of page

Restrictions

Terminating a Natural Subprogram

The invoked Natural subprogram should be terminated with a return to the calling program.

Inadmissible Natural Statements

The following statements must not be used.

When used in the invoked Natural subprogram they will bring about an appropriate Natural runtime error (NAT0967).

Parameter Values Passed by the 3GL Program

The parameter values passed by the 3GL program must not reside in a write-protected storage area.

Dynamic Arrays

Arrays with dynamic ranges are not possible.

TP-Monitor-Specific Restrictions

Top of page