Qualification

Every user-specified name that defines an element in a COBOL source element.

ANS85 and is referenced in that source element

must be unique, either because no other name has the identical spelling and hyphenation, or because the name exists within a hierarchy of names such that references to the name can be made unique by mentioning one or more of the higher levels of the hierarchy. The higher levels are called qualifiers and the process that specifies uniqueness is called qualification. Enough qualification must be mentioned to make the name unique; however, it may not be necessary to mention all levels of the hierarchy.

In the Data Division, all data-names used for qualification must be associated with a level indicator or a level-number. Therefore, two identical data-names must not appear as entries subordinate to a group item unless they are capable of being made unique through qualification

ANS85 or they are never referenced

. In the Procedure Division, two identical paragraph-names must not appear in the same section.

In the hierarchy of qualification, names associated with a level indicator are the most significant, followed by those names associated with level-number 01, followed by names associated with level-number 02 through 49. A section-name is the highest (and the only) qualifier available for a paragraph-name. Thus, the most significant name in the hierarchy must be unique and cannot be qualified. Subscripted or indexed data-names and conditional variables, as well as procedure-names and data-names, can be made unique by qualification. The name of a conditional variable can be used as a qualifier for any of its condition-names. Regardless of the available qualification, no name can be both a data-name and procedure-name.

Qualification is performed by following a data-name, a condition-name, a paragraph-name, or a text-name by one or more phrases composed of a qualifier preceded by IN or OF, which are logically equivalent.

ANS85 When the resource named is a function, the function definition may require the user to specify in the reference to the function a value or set of values for one or more parameters which determine the value of the function for that particular reference. This is accomplished through the specification of arguments as described in the section Function-identifier.

General Format: for Format 1



General Format: for Format 2


paragraph-name [ {IN or OF} section-name ]

General Format: for Format 3


text-name [ {IN or OF} library-name ]
MFXOPEN 

General Format: for Format 4


For the MF dialect, and XOpen: screen-name [ {IN or OF} screen-name ]

General Rules:

  1. Each qualifier must be of a successively higher level and within the same hierarchy as the name it qualifies.
  2. The same name must not appear at two levels in a hierarchy

    ANS85 if it is explicitly referenced within the source unit

    .

  3. If a data-name or a condition-name is assigned to more than one data item in a source element, the data-name or condition-name must be qualified each time it is referred to in the Procedure, Environment, and Data Divisions (except in the REDEFINES clause, where qualification must not be used).
  4. A paragraph-name must not be duplicated within a section. When a paragraph-name is qualified by a section-name, the word SECTION must not appear. A paragraph-name need not be qualified when referred to from within the same section.

    ANS85 Neither a paragraph-name nor a section-name need be unique, or capable of being made unique, unless explicitly referenced.

  5. A data-name cannot be subscripted when it is being used as a qualifier.
  6. A name can be qualified even when it does not need qualification; if there is more than one combination of qualifiers that ensures uniqueness, then any such set can be used. The complete set of qualifiers for a data-name must not be the same as any partial set of qualifiers for another data-name.

    Qualified data-names can have up to five qualifiers.

    ANS85 Up to fifty qualifiers are permitted.

  7. If more than one COBOL library is available to your COBOL system, text-name must be qualified each time it is referenced.

    OSVSVSC2MF This restriction is not enforced.