COBOL Manual for TNS/E Programs (H06.03+)
Calling Other Programs and Routines
HP COBOL Manual for TNS/E Programs—520347-003
23-24
Passing Parameters to Non-COBOL Routines
pTAL
•
If a 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 pTAL procedure expects.
•
If a 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 pTAL procedure can omit any optional
parameters, substituting the keyword OMITTED for each omitted optional
parameter.
•
In pTAL, if you declare a routine to be EXTENSIBLE or VARIABLE, its formal
parameters are optional (meaning that the calling program need not supply the
actual parameters). If an HP COBOL program calls an extensible or variable pTAL
routine, the HP COBOL program must use the keyword OMITTED in place of each
omitted optional parameter, except in the case of trailing omitted optional
parameters. For example, if the pTAL procedure declaration is:
PROC my_proc (a, b, c) VARIABLE;
INT .EXT a;
INT .EXT b;
INT .EXT c;
BEGIN
...
END;
Then an HP COBOL program can call the pTAL routine with any of these
statements:
ENTER TAL "MY_PROC" USING A
ENTER TAL "MY_PROC" USING A B
ENTER TAL "MY_PROC" USING A B C
ENTER TAL "MY_PROC" USING A OMITTED C
C routine:
FUNCT1 (char *d)
...
return void;
Example 23-7. Passing a String to a C Routine (page 2 of 2)










