Natural for UNIX Version 8.3.7 for UNIX
 —  Programming Guide  —

Invoking Natural Subprograms from 3GL Programs

Natural subprograms can be invoked from a Natural object written in a 3rd generation programming language (3GL). The invoking program can be written in any programming language that supports a standard CALL interface.

For this purpose, Natural provides the interface ncxr_callnat. The 3GL program invokes this interface with a specification of the name of the desired subprogram.

Note:
Natural must have been activated beforehand; that is, the invoking 3GL program must in turn have been invoked by a Natural object with a CALL statement.

The subprogram is executed as if it had been invoked from another Natural object with a CALLNAT statement.

When the processing of the subprogram stops (either with the END statement or with an ESCAPE ROUTINE statement), control is returned to the 3GL program.

This document covers the following topics:


Passing Parameters from the 3GL Program to the Subprogram

Parameters can be passed from the invoking 3GL program to the Natural subprogram. For passing parameters, the same rules apply as for passing parameters with a CALL statement.

The 3GL program invokes the Natural interface ncxr_callnat with four parameters:

The sequence, format and length of the parameters in the invoking program must match exactly the sequence, format and length of the fields in the DEFINE DATA PARAMETER statement of the subprogram. The names of the fields in the invoking program and the invoked subprogram can be different.

Top of page

Example of Invoking a Natural Subprogram from a 3GL Program

For an example of how to invoke a Natural subprogram from a 3GL program, refer to the following samples in <install-dir>/natural/samples/sysexuex.

Top of page