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-32
Passing Parameters to Non-COBOL Routines
TAL and pTAL
Every TAL or pTAL procedure specifies, for each of its parameters, whether the
parameter is to be passed by value or by reference and, for TAL, whether it is to be
accessed using a 16-bit or 32-bit address.
If a TAL or pTAL parameter is to be passed by value, an HP COBOL program can pass
a numeric literal, a numeric data item, or the value of an arithmetic expression. The
compiler generates code that evaluates, scales, and converts the value to the form that
the called TAL or pTAL procedure expects.
If a TAL or pTAL parameter is to be passed by reference, an HP COBOL program can
pass an FD file name (to pass the address of the file control block) or a data item (to
pass the address of the data item).
An HP COBOL program that calls a TAL or pTAL procedure can omit any optional
parameters, substituting the keyword OMITTED for each omitted optional parameter.
In both the non-CRE environment and the CRE:
•
In HP COBOL, the default addressing mode is extended (32-bit). In TAL or pTAL,
the addressing mode is explicitly declared for each reference parameter. Standard
indirect addressing is indicated by type.identifier ; for example:
INT .i;
Example 23-9. Passing Parameters to a Pascal routine
HP COBOL code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ONE-WORD USAGE NATIVE-2.
01 TWO-WORD USAGE NATIVE-4.
01 FOUR-WORD USAGE NATIVE-8.
01 A-STRING PICTURE X(25).
...
PROCEDURE DIVISION.
...
ENTER PASCAL "FUNCT1" USING ONE-WORD
TWO-WORD
FOUR-WORD
A-STRING
Pascal routine:
FUNCT1 ( a: integer,
b: longint,
c: int64,
d: fstring (25) );
begin
...
end;