PreviousIntroduction to Compilation Group Definition Environment DivisionNext

Chapter 5: Identification Division

5.1 Identification Division

The Identification Division identifies the program,
class, factory object, object, method,
function or interface.
The basename, derived from the filename of the file containing the source element, also identifies the first source element defined in that file. The paragraph header identifies the type of information contained in the paragraph.The user can include the date the program is written and such other information as desired under the paragraphs shown in the General Format.

This entire division (including the division header) is optional in a program definition.

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 except ISO2000 fully support these obsolete paragraphs. 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.

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

5.2 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 call prototype is identified.

General Formats

Format 1

Format 2

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

Syntax Rules

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.

Formats 1 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:

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

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

    The MAPNAME Compiler directive controls this behavior.

  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.

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, either COMMON, INITIAL or both must be specified. When both are specified, the order is irrelevant.

  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.

General Rules

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.

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

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.

5.3 The CLASS-ID Paragraph

The CLASS-ID paragraph indicates that this identification division is introducing a class definition and specifies the name that identifies the class and assigns class attributes to the class.

General Format

CLASS-ID. [ AS literal-1 ]
	[ INHERITS FROM class-name-2 ]
	[ USING { parameter-name-1 } ... ] .

Syntax Rules

  1. Literal-1 shall be an alphanumeric literal and shall not be a figurative constant.

  2. Class-name-2 shall be the name of a class specified in the REPOSITORY paragraph
    or the CLASS-CONTROL paragraph
    of this source element.

  3. Class-name-2 shall not be the name of the class declared by this class definition.

  4. Class-name-2 shall not inherit from class-name-1 directly or indirectly. Class-name-2 shall not be the name of a parameterized class that expands class-name-1 directly or indirectly.

  5. Parameter-name-1 shall be a name specified in a class-specifier or an interface-specifier in the REPOSITORY paragraph of this class definition.

General Rules

  1. Class-name-1 names the class declared by this class definition. However, literal-1, if specified, is the name of the class that is externalized to the operating environment.

  2. The INHERITS clause specifies the name of the class that is inherited by class-name-1 according to Class inheritance.

  3. The USING phrase specifies that this is a parameterized class. Parameter-name-1 is the name given to the formal parameter. See Parameterized classes for details of the behavior of a parameterized class.

  4. Parameter-name-1 shall be specified within this class definition only where a class-name or an interface-name is permitted.

5.4 The FACTORY Paragraph

The FACTORY paragraph indicates that this identification division is introducing a factory definition.

General Format

FACTORY.

5.5 The OBJECT Paragraph

The OBJECT paragraph indicates that this identification division is introducing an object definition.

General Format

OBJECT.

5.6 The METHOD-ID Paragraph

The METHOD-ID paragraph indicates that this identification division is introducing a method definition, specifies the name that identifies the method and assigns method attributes to the method.

General Format

Syntax Rules

  1. Literal-1 must be an alphanumeric literal and must not be a figurative constant.

  2. If property-name-1 is specified as a data-name in the working-storage section of the containing object or factory definition, the PROPERTY clause must not be specified in the data description entry of that data-name.

  3. If the GET phrase is specified, then the method must have no USING phrase parameters specified in the procedure division header and must have a single RETURNING phrase.

  4. If the SET phrase is specified, then the method must have a single USING parameter specified in the procedure division header and no RETURNING phrase.

  5. If method-name-1 or literal-1 is the same as a method-name inherited by the containing definition, the parameter declarations on the procedure division header must obey the rules of conformance to ensure that the definition that contains this method definition conforms to every inherited definition according to Conformance for parameters and returning items.

General Rules

  1. The name of the method declared by this method definition is determined as follows:
    1. If the PROPERTY clause is specified, the name is formed as follows:
      1. If the GET phrase is specified, the characters "GET" are concatenated to property-name-1 folded to upper case.

      2. If the SET phrase is specified, the characters "SET" are concatenated to property-name-1 folded to upper case.

    2. If the PROPERTY clasue is not specified, the name is method-name-1. However, literal-1, if specified, is the name of the method that is externalized to the operating environment.

  2. The name of this method can be referenced in the invocation of a method for an object of the class in which this method is defined.

  3. If a given user-defined word is defined in the data division of this method definition and in the data division of the containing factory definition or object definition, the use of that word in this method refers to the declaration in this method. The declaration in the containing factory object or object definition is inaccessible to this method.

  4. If the GET phrase is specified, this method is a get property method for property-name-1.

  5. If the SET phrase is specified, this method is a set property method for property-name-1.

5.7 The INTERFACE-ID Paragraph

The INTERFACE-ID paragraph indicates that this identification division is introducing an interface definition, specifies the name that identifies the interface and assigns interface attributes to the interface.

General Format

INTERFACE-ID. interface-name-1 [ AS literal-1 ]
	[ INHERITS FROM interface-name-2 ]
	[ USING { parameter-name-1 } ... ] .

Syntax Rules

  1. Literal-1 must be an alphanumeric literal and must not be a figurative constant.

  2. Interface-name-2 must be the name of an interface specified in the REPOSITORY paragraph of this source element.

  3. Interface-name-2 must not inherit directly or indirectly from interface-name-1.

  4. Parameter-name-1 must be a name specified in a class-specifier or an interface-specifier in the REPOSITORY paragraph of this interface definition.

General Rules

  1. Interface-name-1 names the interface declared by this interface definition. However, literal-1, if specified, is the name of the interface that is externalized to the operating environment.

  2. The INHERITS phrase specifies the name of the interface that is inherited by interface-name-1 according to Interface inheritance.

  3. The USING phrase specifies that this is a parameterized interface. Parameter-name-1 is the name given to the formal parameter.

  4. Parameter-name-1 must be specified within this interface definition only where a class-name or an interface-name is permitted.

5.8 The FUNCTION-ID Paragraph

The FUNCTION-ID paragraph specifies the name by which a function is identified and assigns selected attributes to that function.

General Format

Format 1 (definition):

FUNCTION-ID. user-function-name-1 [ AS literal-1 ].

Format 2 (prototype):

FUNCTION-ID. 
   function-prototype-name-1 [ AS literal-1 ] IS PROTOTYPE.

Syntax Rules

  1. Literal-1 must be an alphanumeric literal and must not be a figurative constant.

General Rules

Format 1

  1. User-function-name-1 names the function declared by this function definition. However, literal-1, if specified, is the name of the function that is externalized to the operating environment.

Format 2

  1. Function-prototype-name-1 names the function prototype declared by this definition. However, literal-1, if specified, is the name of the function prototype that is externalized to the operating environment.

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


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

PreviousIntroduction to Compilation Group Definition Environment DivisionNext