COBOL Manual for TNS/E Programs (H06.03+)
Calling Other Programs and Routines
HP COBOL Manual for TNS/E Programs—520347-003
23-6
Calling Non-COBOL Routines
Every program that a dynamic call could possibly call (in the preceding example, the
programs POSRTN and NEG0RTN) must be linked into the run unit or user library
before you execute the program (see Linking HP COBOL Programs).
If you want an HP COBOL program to be entirely free to call any other COBOL
program that is prepared to be called, make the programs separate processes.
Separate processes communicate through the file process $RECEIVE—the sender
writes to a named process, and the receiver reads a file named $RECEIVE. For more
information about $RECEIVE, see $RECEIVE.
Calling Non-COBOL Routines
The way an HP COBOL program can call a non-COBOL routine depends on whether
the calling program was compiled with the PORT directive. An HP COBOL program
that was not compiled with the PORT directive calls a non-COBOL routine with the
ENTER statement. An HP COBOL program that was compiled with the PORT directive
calls a non-COBOL routine with either the ENTER statement or the CALL statement,
which behaves like an X/Open CALL statement.
Topics:
•
ENTER Statement
•
X/Open CALL Statement
•
Functions (Routines That Return Values)
•
Operating System Routines
•
HP COBOL Run-Time Routines
•
COBOL Utility Routines
•
ENFORM Programs
•
Restrictions on Calling Non-COBOL Routines
ENTER Statement
If an HP COBOL program is not compiled with the PORT directive, it can call routines
written in native HP C, native HP C++, and pTAL by using the ENTER statement.
Note. If the types of the actual and formal parameters do not match, the ENTER statement
attempts to convert the actual parameters to the types of the formal parameters; the X/Open
CALL statement reports an error instead.
Applying a CANCEL statement to a non-COBOL routine that was called with an X/Open CALL
statement terminates the run unit.










