COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
a^proc (a^string:length)
string .ext a^string
int length;
An HP COBOL program that calls a 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 pTAL routine.
For example, suppose that your HP COBOL program calls the 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.
The code for reference modification is:
01 A-FILENAME PIC X(20)
...
MOVE 0 TO A-COUNT
INSPECT FUNCTION REVERSE (A-FILENAME) TALLYING A-COUNT
FOR LEADING SPACES
ENTER "FILE_GETINFOBYNAME_"
USING A-FILENAME
(1: FUNCTION LENGTH (A-FILENAME) - A-COUNT) ...
The code for using an OCCURS clause is:
01 A-FILENAME.
02 PIC X OCCURS 1 TO 20 TIMES DEPENDING ON
A-FILENAME-LENGTH.
01 A-FILENAME-LENGTH PIC 99 COMP.
Set A-FILENAME-LENGTH to the right length and call FILE_GETINFOBYNAME_ without using
reference modification.
For more information about pTAL procedures, see the pTAL Reference Manual.
Example 257 Passing Parameters to a pTAL 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 TAL "proc1" USING ONE-WORD
TWO-WORD
FOUR-WORD
A-STRING
pTAL routine:
PROC proc1 (a, b, c, d);
INT a;
INT(32) b;
FIXED(0) c;
STRING .d; -- pointer to array
BEGIN
...
END;
Passing Parameters 811










