PreviousIntroduction to Program Definition Environment DivisionNext"

Chapter 5: Identification Division

5.1 Identification Division

The Identification Division identifies the source program and the resultant output listing. The user can include the date the program is written and such other information as desired under the paragraphs in the General Format shown on the next page.

This entire division (including the division header) is optional.

The AUTHOR, INSTALLATION, DATE-WRITTEN , DATE-COMPILED, and SECURITY paragraphs are classed as obsolete elements in the ANSI'85 standard and may be deleted from the next full revision of the ANSI Standard.

All dialects in this COBOL implementation fully support this syntax. The FLAGSTD Compiler directive can be used to detect all occurrences of this syntax.

Although they are a part of the standard COBOL definition, the obsolete paragraphs are explicitly excluded from the X/Open COBOL language definitions and should not be used in a conforming X/Open source program.

5.1.1 Organization

Paragraph headers identify the type of information contained in the paragraph. The name of the program must be given in the PROGRAM-ID paragraph. The other paragraphs are optional and can be included in this division at the user's choice, in the order of presentation shown by the general format below.

5.1.2 Structure

The General Format of the paragraphs in the Identification Division is given below.

Paragraphs can appear in any order.

General Format

Syntax Rules

  1. The paragraphs can appear in any order.

  2. The periods following the paragraph-names in the Identification Division are optional as is the period following the program-name.

  3. The comment-entry can be any combination of the characters from the computer's character set. The continuation of the comment-entry by the use of a hyphen in the continuation area is not permitted. If the Compiler directive SOURCEFORMAT is specified as or defaulted to FIXED, the comment-entry can be contained on one or more lines but is restricted to area B of those lines; the next line commencing in area A will begin the next non-comment entry.

    If the Compiler directive SOURCEFORMAT is specified as FREE, the comment-entry cannot be continued; the next line will begin the next non-comment entry.

    The comment-entry can contain the SKIP1, SKIP2, SKIP3, EJECT or TITLE statements anywhere on the line. These statements will be actioned if they are alone on a line in the comment-entry, and will not terminate the comment-entry.

    The comment-entry can contain the SKIP1, SKIP2, SKIP3, or EJECT statements anywhere in the B margin. These statements will be actioned if they are alone on a line in the comment-entry, and will not terminate the comment-entry.

    The comment-entry can be contained in either area A or area B of the comment-entry lines. However, the next occurrence in area A of any one of the following COBOL words or phrases will terminate the comment-entry and begin the next paragraph or division:

    PROGRAM-ID
    AUTHOR
    INSTALLATION
    DATE-WRITTEN
    DATE-COMPILED
    SECURITY
    ENVIRONMENT
    DATA
    PROCEDURE

  4. When the EXTERNAL clause is specified in the PROGRAM-ID paragraph, then no other IDENTIFICATION DIVISION paragraphs should be specified, no ENVIRONMENT DIVISION should be specified, only the LINKAGE SECTION should be specified in the DATA DIVISION, and only the PROCEDURE DIVISION header and ENTRY statements should appear in the PROCEDURE DIVISION.

General Rules

  1. The EXTERNAL clause establishes that a program is intended as a call prototype and not as executable object code.

5.1.2.1 The PROGRAM-ID Paragraph
diala.gifand Nested Source Programs

Function

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

General Formats

Format 1

Format 2

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 semantics described in this section.

Syntax Rules

  1. The program-name must conform to the rules for formation of a user-defined word.

  2. The first 8 characters of program-name of the outermost program should be unique in the system. The first character must be alphabetic; otherwise it is converted as follows:

    If a hyphen is used in characters 2 through 8 of the program-name of the outermost program, it is changed to zero (0).

    For programs that are contained in another program, program-name 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. Lowercase letters are valid, but such program-names will be handled in a case-insensitive manner.

    The MAPNAME Compiler directive controls this behavior.

  3. The program-name 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 $.

  4. The program-name can be the same as another user-defined word.

    The program-name cannot be the same as another user-defined word.

  5. The program-name of a nested program must be unique within theseparately compiled program containing it.

  6. The optional COMMON clause can be used only if the program is contained within another program.

  7. If the IS PROGRAM phrase is present, either COMMON, INITIAL or both must be specified. When both are specified, the order is irrelevant.

General Rules

  1. The program-name is associated with the object code file pertaining to this COBOL program.

  2. 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.

  3. 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 section Initial State Of A Program earlier in this chapter.

5.1.2.2 Common Programs and Initial Programs

A common program is one which, despite being directly contained in another program, can be called by any program directly or indirectly contained in that other progam. The common attribute is attained by specifying the COMMON clause in a program's Identification Division. The COMMON clause facilitates the writing of subprograms which are to be used by all the programs contained in a program.

An initial program is one whose program state is initialized when the program is called. Thus, whenever an initial program is called, its program state is the same as when the program was first called in that run unit. During the process of initializing an initial program, that program's internal Working-Storage data is initialized; thus an item of the program's internal data whose description contains a VALUE clause is initialized to that defined value,

but an item whose description does not contain a VALUE clause is initialized to a value depending on the DEFAULTBYTE Compiler directive.

Files with internal file connectors associated with the program are not in the open mode. The control mechanisms for all PERFORM statements contained in the program are set to their initial state. A GOTO statement referred to by an ALTER statement contained in the same program is set to its initial state. The initial attribute is attained by specifying the INITIAL clause in the program's Identification Division.

5.1.2.2.1 Sharing Data

Two programs in a run unit can reference common data in the following circumstances:

5.1.2.2.2 Sharing File Connectors

Two programs in a run unit can reference common file connectors in the following circumstances:

5.1.2.3 The DATE-COMPILED Paragraph

Function

The DATE-COMPILED paragraph provides the date the intermediate code was produced in the Identification Division source program listing.

General Format

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 semantics described in this section.

Syntax Rules

  1. The comment-entry can be any combination of the characters from the computer's character set. The continuation of the comment entry by use of the hyphen is not permitted; however, the comment entry can be contained on one or more lines. The comment-entry lines must be contained in area B. The next line commencing in area A will begin the next non-comment paragraph.

General Rules

  1. The paragraph-name DATE-COMPILED causes your COBOL system to insert a date comment-entry as the executable code is created. If a DATE-COMPILED paragraph is present (with or without a comment-entry), the paragraph is replaced in the program listing with one of the form:
      DATE-COMPILED. current-date-and-time .

    where the date and time format is DD-MMM-YY hh:mm.

    The DATE Compiler directive can impact the comment-entry replacement string for your COBOL implementation.

    The value inserted in the DATE-COMPILED paragraph will also be the value used in the When-Compiled intrinsic function. However, the format can differ.

5.1.2.4 The REMARKS Paragraph

The REMARKS paragraph allows a comment-entry to be specified. (See Syntax Rule 3 under the section Identification Division earlier in this chapter.)


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousIntroduction to Program Definition Environment DivisionNext"