The PROCEDURE DIVISION Header

The Procedure Division is identified by and must begin with a header in one of the following formats:

General Formats for Format 1

MF 

General Formats for Format 2


*
NETJVM 

General Formats for Format 3

Directives

  1. In addition to Compiler directives which provide flagging and modify the reserved word list, the following directives may impact either the syntax or the semantics described in this section.
    • DEFAULTCALLS - sets the default calling convention if none is explicitly coded in the Procedure Division header.
    • STICKY-LINKAGE - controls whether addressability to Linkage Section items is maintained between calls to different entry points in the same program.

Syntax Rules for All Formats

  1. MF Mnemonic-name is necessary only if the runtime element is being invoked by another runtime element and that runtime element is using a calling convention other than that used as default by your COBOL system. Typically, the default COBOL calling convention is consistent with that used by a significant implementation of a non-COBOL language for the run-time environment.

    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.

  2. MF CHAINING and USING are equivalent.
  3. ISO2002MF If data-name-1 or data-name-2 is defined with the USAGE OBJECT REFERENCE clause, the ACTIVE-CLASS phrase must not be specified.
  4. ISO2002MF Data-name-3 must be defined as a level 01 or level 77 entry in the Linkage Section. The data description entry for data-name-3 must not contain a REDEFINES clause. A data item elsewhere in the Linkage Section may specify REDEFINES data-name-3.
  5. ISO2002MF Data-name-3 must not be the same as data-name-1 or data-name-2.

Syntax Rules for Format 1

  1. Data-name-1 must be defined as a level 01 or a level 77 entry in the Linkage Section

    MF , File Section or Working-Storage Section

    . A particular user-defined word must not appear more than once as data-name-1.

    OSVSVSC2MF It may appear more than once.

    The data description entry for data-name-1 must not contain a REDEFINES clause.

    OSVSVSC2MF It may contain a REDEFINES clause.

    Data-name-1 may, however, be the object of a REDEFINES clause elsewhere in the Linkage Section.

  2. ISO2002MF Data-name-2 must be defined as a level 01 or a level 77 entry in the Linkage Section

    MF , 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.

    MF For JVM and .NET COBOL, data-name-2 can be any class and must be no greater than 8 bytes. For native COBOL, data-name-2 can be of any class except comp-1 and comp-2. The length must be no greater than 4 bytes for 32-bit compilation, and no greater than 8 bytes for 64-bit compilation.

ISO2002MFNETJVM 

Syntax Rules for Formats 1 and 3

  1. ISO2002MFNETJVM The RETURNING phrase must be specified in a function definition and in a function prototype definition.
  2. ISO2002MFNETJVM The RETURNING phrase may be specified in a method definition, a program definition or a program prototype.
MF 

Syntax Rules for Format 2

  1. MF Format 2 can only be used in a program in which the EXTERNAL clause is specified in the Program-ID paragraph, that is a call prototype.
  2. MF Data-name-1 and data-name-2 must be defined as 01 level records in the Linkage Section.
  3. MF Typedef-name-1, typedef-name-2, and typedef-name-3 must be previously defined in the same source file as a programmer-defined usage by means of a TYPEDEF clause.
NETJVM