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

What HP COBOL Can Pass by Value.
Passing Parameters to COBOL Programs
Passing Parameters to Non-COBOL Routines
Addressing Modes
Native programs use 32-bit addressing for all data items. Many HP COBOL items are
byte-addressed. Some data items in other languages are 2-byte addressed. When you pass a
byte-addressed item to a routine that expects a 2-byte-addressed parameter, the data item must
be aligned on a 2-byte boundary; otherwise, problems can arise, because the called routine is
expecting an aligned parameter.
Special registers are not addressable data items. If passed as parameters, they must be passed
by value.
What HP COBOL Can Pass by Content
An HP COBOL program can pass these types of items to non-COBOL routines by content:
Elementary Data Items
Tables
Numeric Literals
Values of Arithmetic Expressions
HP COBOL File Names
Elementary Data Items
The most practical categories and sizes for elementary data item parameters to be passed by
content are:
USAGEParameter Category and Size
NATIVE-2Numeric 2-byte
NATIVE-4Numeric 4-byte
NATIVE-8Numeric 8-byte
PICTURE X(n )Alphanumeric
The names of elementary data item parameters can be qualified, subscripted, or both, but cannot
include reference modifiers.
Passing a COMPUTATIONAL numeric data item as a parameter is not recommended. Although
a data item described as
PICTURE S9(4) USAGE COMPUTATIONAL
is allocated 2 bytes, the value that can be stored in them must be in the COMPUTATIONAL range
-9999 through 9999. Anything outside that range is truncated on the left by the MOVE operation.
The compiler generates any code necessary to convert numeric actual parameters to the form
required by the external routine, including scaling and conversion to the required storage size and
data type. Similarly, the compiler generates any code that is necessary to convert the numeric
value that an external routine returns to the form required by the data item in the GIVING phrase
of the HP COBOL program’s ENTER statement.
The other CRE languages handle nonnumeric data items as strings.
Passing Parameters 805