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-33
Passing Parameters to Non-COBOL Routines
Extended indirect addressing is indicated by type.EXT identifier ; for
example:
INT .EXT i;
You can specify standard (16-bit) addressing in HP COBOL with an ACCESS
MODE clause. Verify that each actual HP COBOL parameter uses the same
addressing mode as its corresponding formal TAL or pTAL parameter.
•
In TAL or 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
TAL or 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 TAL 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 TAL 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
•
TAL and pTAL have a parameter type called string:length that is defined:
a^proc (a^string:length)
string .ext a^string
int length;
An HP COBOL program that calls a TAL or pTAL routine that has a
string :length parameter only passes one parameter, the string part. The
compiler computes the length of the string and passes it to the TAL or pTAL
routine.
For example, suppose that your HP COBOL program calls the TAL or pTAL routine
FILE_GETINFOBYNAME_, which has the parameter file-name :maxlen. To
have your HP COBOL program pass the entire item, you can use this code:
01 A-FILENAME PIC X(20)
...
ENTER "FILE_GETINFOBYNAME_" USING A-FILENAME ...
To have your HP COBOL program pass part of the item, you can use either
reference modification or an OCCURS clause.