COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Some values on NonStop systems that fit into an HP COBOL data item described as PICTURE S9(n
-s)V9(s ) COMPUTATIONAL exceed HP COBOL’s limits. More importantly, HP COBOL generates
computational code based on the descriptions of data items, so if an external routine installs a
value in a PICTURE S9(n -s )V9(s ) COMPUTATIONAL field that HP COBOL could not have stored,
the computational results could be invalid.
Records
HP COBOL programs must pass record parameters by reference.
What HP COBOL Can Pass by Value
An HP COBOL program can pass these types of items to non-COBOL routines by value:
Numeric literals
Numeric data items
Special registers
Arithmetic expressions
If a parameter is passed by value, it is evaluated, scaled, and converted to the storage size and
type of the formal parameter. The resulting value is passed to the called routine. This conversion
might cause an arithmetic overflow.
Passing Parameters to COBOL Programs
A COBOL program can pass parameters to another COBOL program with the CALL statement.
A non-COBOL routine can pass parameters to a COBOL program with the non-COBOL language’s
method of calling an external routine. The method varies from language to language; see the
reference manual for appropriate non-COBOL language.
Topics:
From HP COBOL Programs
From Non-COBOL Routines
From HP COBOL Programs
By default, the CALL statement passes parameters by reference. This means that the called program
can change the value of the parameter that is stored in the calling program.
You can specify that the CALL statement is to pass a parameter by content instead of by reference.
This means that the called program cannot change the value of the parameter that is stored in the
calling program. To specify that a parameter is to be passed by content, specify CONTENT in a
USING phrase in the CALL statement.
A COBOL program can pass a program name (a program-name in a PROGRAM-ID paragraph)
as a parameter to another COBOL program (see Dynamic Calls).
From Non-COBOL Routines
When calling a COBOL program from a non-COBOL program, remember that:
A non-COBOL program must pass any parameters to COBOL program by reference.
A non-COBOL program cannot pass a program name (a program-name for a PROGRAM-ID
paragraph) to a COBOL program as a parameter.
COBOL has no single-byte numeric data type that corresponds to:
HP C and C++ data types char and unsigned char
pTAL data types UNSIGNED(8) and STRING
Passing Parameters 807