ILE COBOL Language Reference
The USING phrase makes data items defined in a calling program available to
a called subprogram.
The following rules for the USING phrase assume that the calling and called
programs are written in COBOL.
- The USING phrase is specified in the Procedure Division header if, and
only if, this program is a subprogram invoked by a CALL statement that itself
contains a USING phrase. For each CALL USING statement in a calling
program, there must be a corresponding USING phrase specified in a called
subprogram
- The USING phrase is valid in the Procedure Division header of a called
subprogram.
- Each USING identifier must be defined as a level-01 or level-77 item in
the Linkage Section of the called subprogram
- A USING identifier must not contain a REDEFINES clause
- A particular user-defined word cannot appear more than once as data-name-1
- In a calling program, the USING phrase is valid for the CALL
statement; each USING identifier must be defined as a level-01, level-77,
or an elementary item in the Data Division
- The maximum number of data-names that can be specified is 255 when a
program is called with a LINKAGE TYPE of program. For programs called
with LINKAGE TYPE of procedure, the maximum number of data-names is
400.
- The order of appearance of USING identifiers in both calling and called
subprograms determines the correspondence of single sets of data available to
both programs. The correspondence is positional and not by name.
Corresponding identifiers must contain the same number of characters, although
their data descriptions need not be the same. For index-names, no
correspondence is established; index-names in calling and called programs
always refer to separate indexes.
- The identifiers specified in a CALL USING statement name data items
available to the calling program that can be referred to in the called
program; a given identifier can appear more than once. These items
are defined in any Data Division section.
- A USING identifier containing the GLOBAL clause can be specified in only
one Procedure Division header in a compilation
unit.
+-------------------------------IBM Extension--------------------------------+
- An identifier can appear more than once in a Procedure Division USING
phrase. In that case, the last value assigned to the identifier by a
CALL USING statement is used.
+----------------------------End of IBM Extension----------------------------+
- Data items defined in the Linkage Section of the called program
may be referenced within the Procedure Division of that program if, and only
if, they satisfy one of the following conditions:
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.