COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Presenting Parameters to the Called Program
A formal parameter in the called program can have one of two attributes: value or reference.
Depending on the description of the actual parameter in the calling program and the description
of the formal parameter in the called program, the compiler generates code to convert the value
of the actual parameter to match the description of the formal parameter.
ExplanationParameter
When a formal parameter in the called routine has the VALUE attribute and is numeric, the compiler
generates any code necessary to evaluate the actual parameter, convert the value to the expected
representation and scaling, and pass the value to the called program.
VALUE
When a formal parameter has the VALUE attribute but is nonnumeric, the compiler generates code
to pass the value to the called program.
When an actual parameter in the calling program is a literal or an arithmetic expression, the
corresponding formal parameter must have the VALUE attribute.
When a formal parameter has the REFERENCE attribute, the actual parameter supplies access to
an object in the calling program.
REFERENCE
When an actual parameter is an identifier, the compiler generates code to pass the address of
the associated data item to the called program. In this case, the calling program and the called
program must agree on the interpretation of the data item value.
When an actual parameter is a file name, the compiler generates code to pass the address of the
file control block. Use this option only where specified for a program supplied by HP.
When the parameter in the calling program is specified by the reserved word OMITTED, the
compiler generates no code to convert or pass anything. The calling program can use OMITTED
OMITTED
only when the called program has the EXTENSIBLE or VARIABLE attribute. The calling program
and the called program must agree on which operands can be OMITTED.
Delivering the Returned Value
When an ENTER statement has a GIVING phrase, the compiler generates code to deliver the value
that the program returns to a data item in the calling program. The generated code performs any
necessary scaling of the result value, then performs an assignment according to the rules for an
elementary move operation.
Linking the Object Code
When the compilation source text includes a separately compiled program, and the compiler
reports no error against that program, the target file includes the object code for that program.
The object code for nested programs is inseparable from the code for their outermost separately
compiled program.
When a separately compiled HP COBOL program or a non-COBOL program is available in object
form, and the compiler locates it using a file-mnemonic or primary search list, the target file
includes the object code for that program.
When the ECOBOL compiler finds a program in the ZCOBDLL, ZCREDLL, or ECOBEXT file, the
compiler validates parameters, but does not bind the object code into the target file.
#RECEIVE Blocks
When the linker creates a run unit, it compares the #RECEIVE blocks of all the programs and
determines which argument values are to be used whenever another HP COBOL object file opens
$RECEIVE.
522 Program Compilation










