COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Tables
To pass a table (an array) by content, you must create a data structure that consists solely of the
array elements and pass the name of that data structure. The corresponding formal parameter must
be defined to use a content parameter. For example, to pass the table of Cs in Example 252, you
must pass the name C-ARRAY.
Example 252 Record Containing a Table
01 A-RECORD.
03 A PIC S999V99.
03 B PIC S999V99.
03 C-ARRAY.
05 C OCCURS 7 TIMES USAGE NATIVE-2.
03 D PIC X(15).
HP COBOL handles any data structure as a stream of characters, so the compiler does not perform
numeric conversions on table elements. If you have a table of elements whose descriptions do not
match those of their corresponding formal parameters, you must create a new table whose element
descriptions match exactly, copy the values form the original table to the new table, and pass the
name of the new table as the actual parameter.
Numeric Literals
HP COBOL can pass numeric literals, but not nonnumeric literals, as content parameters. The
compiler generates any code that is necessary to convert them to the form required by the external
routine.
Values of Arithmetic Expressions
HP COBOL can pass the value of an arithmetic expression to native HP C, native HP C++, and
pTAL routines by content. The compiler generates any code that is necessary to convert the value
of an arithmetic expression to the form required by the external routine.
HP COBOL File Names
HP COBOL can pass COBOL file names to ZCOBDLL routines that accept them. The COBOL file
name is the file name recognized by the HP COBOL program’s input-output statements, not the file
name recognized by the operating environment. The data structures that enable the ZCOBDLL
routines to accept COBOL file names are proprietary to HP and are not available to users.
What HP COBOL Can Pass by Reference
An HP COBOL program can pass these to non-COBOL routines by reference:
• Elementary Data Items
• Records
Elementary Data Items
The only elementary data items that HP COBOL programs can always pass by reference are
NATIVE-2, NATIVE-4, NATIVE-8, and PICTURE X (n ) data items. If an external routine stores an
integer value in a COMPUTATIONAL numeric data item, and that value exceeds HP COBOL’s
limits (4 decimal digits for 16 bits of storage, 9 decimal digits for 32 bits of storage, and 18
decimal digits for 64 bits of storage), results from using the contents of that data item are
unpredictable—the program might work as expected, not work as expected, or terminate
abnormally.
HP COBOL programs can also pass by reference a numeric data item with a PICTURE containing
V or P, but only if the corresponding formal parameter is the equivalent of an 8-byte integer and
the HP COBOL program and external routine agree on an interpretation.
806 Calling Other Programs and Routines










