PROCEDURE DIVISION Header [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
PROCEDURE DIVISION Header
The PROCEDURE DIVISION header has the following format:
PROCEDURE DIVISION [USING {data-name-1}...]
The PROCEDURE DIVISION header begins in Area A of the program. Note that
the header must be terminated by a period followed by a space.
USING Clause
The USING clause in the PROCEDURE DIVISION header is required only if the
program containing it is to be called by another COBOL program through
the CALL statement. The CALL statement itself includes a USING clause.
That is, the USING clause in a PROCEDURE DIVISION header identifies the
program in which it appears as a subprogram that references data common
to the program that calls it.
The data names in the USING clause must follow the rules listed below.
1. Each data item named in the USING phrase of a PROCEDURE DIVISION
header must be described as 01 or 77. In ANSI COBOL'85 a data
item must not have a REDEFINES clause in its description. HP
COBOL II allows this as an HP extension to the ANSI COBOL
standard.
2. Data items are processed according to their descriptions in the
called program, and not according to their descriptions in the
calling program. Note that although this implies that common data
may have different usages, the data must, as a general rule, have
the same usage. Results may be undefined if usages are mixed.
This is because data sharing is done by passing an address of the
data item (when passing by reference), with no conversion from one
data type to another.
3. The descriptions of data common to both programs must define an
equal number of character positions.
4. Data is passed from one program to another according to the
position of its name in the USING phrase, and not by its name.
Thus, data in the calling program may be known to the calling
program by a completely different name. The same name can appear
in the USING phrase of the CALL statement, but each name in the
USING phrase of a PROCEDURE DIVISION header must be unique with
respect to other names in that phrase.
5. For the limit on the number of data names listed in the USING
phrase, refer to "MPE XL System Dependencies" in Appendix H
for more information.
For a more general overview of passing data to and from two COBOL
programs, refer to Chapter 11 , "Interprogram Communication."
MPE/iX 5.0 Documentation