The Program-ID Paragraph

The Program-ID paragraph gives the name by which a program is identified and assigns selected program attributes to that program.

The Program-ID paragraph specifies the name by which a program prototype is identified.

The Program-ID paragraph specifies the name by which a call prototype is identified.

General Formats for Format 1


*

General Formats for Format 2


*

General Formats for Format 3


*

General Formats for Format 4


*

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.
    • CASE - determines whether upper-case and lower-case letters are considered equivalent.
    • DEFAULT-BYTE - sets the value for data items defined in Working-Storage Section without a VALUE clause.
    • MAPNAME - impacts the handling of non-alphabetic characters in the program-name.
    • PROGID-COMMENT - causes Format 1 to be assumed rather than Format 2.

Syntax Rules for All Formats

  1. Program-name-1 can be a nonnumeric literal specified with or without enclosing quotation marks. The content of the literal must follow the rules for formation of program-names, but may also contain the characters @, #, and $.
  2. Program-name-1 must not be the same as another user-defined word.

    Program-name-1 can be the same as another user-defined word.

Syntax Rules for Formats1 and 2

  1. The first 8 characters of program-name-1 of a program that is not contained in another program should be unique in the system. The first character must be alphabetic; otherwise it is converted as follows:
    • 1 through 9 are changed to A through I respectively.
    • Anything else is changed to J.

    If a hyphen is used in characters 2 through 8 of program-name-1 in a program that is not contained in another program, it is changed to zero (0).

    The MAPNAME Compiler directive controls this behavior.

    For programs that are contained in another program, program-name-1 can be any valid user-defined COBOL word, up to 30 characters long. The first eight characters need not be unique, and they will not be converted as described above. Lower-case letters are valid, but such program-names will be handled in a case-insensitive manner.

  2. A program contained within another program must not be assigned the same name as that of any other program contained within the compilation unit that contains this program.

Syntax Rules for Format 2

  1. The optional COMMON clause can be used only if the program is contained within another program.
  2. If the IS PROGRAM phrase is present, at least one of COMMON or INITIAL

    ISO2002MFOS390 or RECURSIVE

    must be specified.

  3. Literal-1 must be an alphanumeric literal and must not be a figurative constant.
  4. Literal-1 must not be specified in a program that is contained within another program.
  5. The RECURSIVE clause must not be specified if any program that directly or indirectly contains this program is an initial program.
  6. The RECURSIVE clause must not be specified in a program that is contained within another program.
  7. The RECURSIVE clause must not be specified in a program that contains another program.

Syntax Rules for Format 4

  1. Program-prototype-name-1 identifies the program prototoype. However, literal-1, if specified, is the name of the program prototype that is externalized to the operating environment.

General Rules for Formats 1 and 2

  1. Program-name-1 names the program declared by this program definition and is associated with the object code file pertaining to this program. Literal-1, if specified, is the name of the program that is externalized to the operating environment.

General Rules for Format 2

  1. The COMMON clause specifies that the program is common. A common program is contained within another program but can be called from programs other than that containing it.
  2. The INITIAL clause specifies that the program is initial. When an initial program is called, it and any programs contained within it are placed in their initial state. See the topic Initial State in the chapter Language Fundamentals.
  3. ISO2002MFOS390 The RECURSIVE clause specifies that the program is recursive.

    Any programs contained within a recursive program are recursive.

    A program in which the Local-Storage Section is specified is recursive.

    A recursive program may be called while it is active and may call itself.

  4. If the RECURSIVE clause is not specified in a program or implied for a program, the program must not be called while it is active.
  5. Additional rules concerning common, initial and recursive programs are given in the topic Common, Initial and Recursive Attributes in the chapter Language Fundamentals

General Rules for Format 3

  1. Program-name-1 names the call prototype that will be used during syntax checking to determine the validity and nature of CALL literal statements.