The Procedure Division is identified by and must begin with a header in one of the following formats:
Mnemonic-name must be defined in the Special-Names paragraph. See the topic The Special-Names Paragraph in the chapter Environment Division for details of how to do this and your COBOL system documentation on interfacing for details of which calling conventions are supported in your run time environment.
, File Section or Working-Storage Section
. A particular user-defined word must not appear more than once as data-name-1.
It may appear more than once.
The data description entry for data-name-1 must not contain a REDEFINES clause.
It may contain a REDEFINES clause.
Data-name-1 may, however, be the object of a REDEFINES clause elsewhere in the Linkage Section.
, File Section or Working-Storage Section , unless the source unit is a method definition or method prototype definition
. Data-name-2 must be defined as a data item of class numeric, object or pointer.
Data-name-2 can be of any class, but the length must be no greater than 8 bytes.
Up to sixty-two data-names are permitted in the USING phrase.
, data-name-2 and data-name-3
are resolved in accordance with their description in the Linkage Section. If this description defines a greater number of character positions than the corresponding data item in the activating element, unpredictable results can occur. Failure to comply with this rule or exceeding the maximum allowed size of the system area for a particular run time environment may result in the system becoming catastrophically corrupt.
, function
or method for any arguments passed to it
. The arguments passed to it are identified in the activating source element by one of the following:
The correspondence between the two lists of names is established on a positional basis
If the activated runtime element is a program for which there is no program-specifier in the Repository paragraph of the activating runtime element, the allocated record is handled as follows.
The allocated record is of the same length as the argument, where the maximum length is used if the argument is described as a variable-occurrence data item. That argument is moved to this allocated record without conversion. This record is then treated by the activated runtime element as if it were the argument and as if it were passed by reference.
If the activated runtime element is one of the following:
then this allocated record is one of:
The argument is used as the sending operand and the allocated record as the receiving operand in one of the following:
The allocated record is then treated as if it were the argument and it were passed by reference.
Note that, in COBOL, the storage for the returning item is allocated in the activating source unit. The activated element contains only a formal description in its linkage section.