COBOL Manual for TNS and TNS/R Programs
Calling Other Programs and Routines
HP COBOL Manual for TNS and TNS/R Programs—522555-006
23-8
ENTER Statement
TNS Programs
If a TNS HP COBOL program is not compiled with the PORT directive, it can call
routines written in TNS HP C, TNS HP C++, FORTRAN, Pascal, and TAL by using the
ENTER statement.
In the ENTER statement, you can specify the language of the called routine. Although
you can specify the language COBOL, the COBOL85 compiler ignores any ENTER
COBOL statements it encounters (to call another COBOL program, use the CALL
statement).
The COBOL85 compiler reports an error if the called routine was not written in the
specified language, except when the specified language is HP C and the routine was
written in HP C++, which the COBOL85 compiler handles as if it were HP C.
The COBOL85 compiler has no way to declare that it is calling a routine that is written
in an unspecified language. If you do not specify a language in the ENTER statement,
you are declaring that the called routine is a TAL procedure that uses FORTRAN
protocol for passing string parameters (that is, a routine that can be called by both
COBOL and FORTRAN programs). The Saved Message Utility (SMU) routines are in
this category.
Any non-COBOL routine called by an HP COBOL program must have already been
compiled, and its object program forms must be available to the COBOL85 compiler
through one of the standard library files or through the SEARCH, LIBRARY, or
CONSULT directive.
In the non-CRE environment, if any program or routine in a loadfile is an HP COBOL
program, the main program must be an HP COBOL program. In the CRE, the main
program can be written in any language that runs in the CRE (that is, HP COBOL,
HP C, FORTRAN, Pascal, or pTAL).
Native Programs
If a native 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.
In the ENTER statement, you do not need to specify the language of the called routine,
because the NMCOBOL compiler can determine the language in which the program is
written. If you do specify the language, it must be C or TAL. If you specify TAL, the
NMCOBOL compiler expects a pTAL program (it does not accept TAL programs). If
you specify FORTRAN or Pascal, the NMCOBOL compiler reports an error. If you
specify C, the compiler expects a routine written in either HP C or HP C++. Although a
native HP COBOL program can use the ENTER statement to call HP C++ and pTAL
programs, you cannot specify the language C++ or pTAL.
Any non-COBOL routine called by an HP COBOL program must have already been
compiled, and its object program forms must be available to the NMCOBOL compiler
through an SRL or object file, specified through the SEARCH or CONSULT directive.