Format 2

This format associates a value, values, or ranges of values with a condition-name. Each such condition-name requires a separate level-88 entry. Level-number 88 and the condition-name are not part of the format-2 VALUE clause itself. They are included in the format only for clarity.

Format 2: condition-name value

Read syntax diagramSkip visual syntax diagram88condition-name-1VALUEISVALUESAREliteral-1THROUGHTHRUliteral-2.

condition-name-1
A user-specified name that associates a value with a conditional variable. If the associated conditional variable requires subscripts or indexes, each procedural reference to the condition-name must be subscripted or indexed as required for the conditional variable.

Condition-names are tested procedurally in condition-name conditions (see Conditional expressions).

literal-1
Associates the condition-name with a single value.

The class of literal-1 must be a valid class for assignment to the associated conditional variable.

literal-1 THROUGH literal-2
Associates the condition-name with at least one range of values. When the THROUGH phrase is used, literal-1 must be less than literal-2, unless the associated data item is a non-year-last windowed date field. For details, see Rules for condition-name entries.

literal-1 and literal-2 must be of the same class. The class of literal-1 and literal-2 must be a valid class for assignment to the associated conditional variable.

The range of alphanumeric literals, national literals, or DBCS literals specified for the THROUGH phrase is based on the collating sequence in effect for the associated conditional variable. For more information about collating sequences, see Locale considerations.

If the associated conditional variable is of class DBCS, literal-1 and literal-2 must be DBCS literals. The figurative constant SPACE or the figurative constant ALL DBCS-literal can be specified.

If the associated conditional variable is of class NATIONAL, literal-1 and literal-2 must be either both national literals or both alphanumeric literals for a given condition-name. The figurative constants ZERO, SPACE, QUOTE, HIGH-VALUE, LOW-VALUE, symbolic-character, ALL national-literal, or ALL literal can be specified.

Rules for condition-name entries

There are certain rules for condition-name entries.

The rules are:

  • The VALUE clause is required in a condition-name entry, and must be the only clause in the entry. Each condition-name entry is associated with a preceding conditional variable. Thus every level-88 entry must always be preceded either by the entry for the conditional variable or by another level-88 entry when several condition-names apply to one conditional variable. Each such level-88 entry implicitly has the PICTURE characteristics of the conditional variable.
  • A space, a separator comma, or a separator semicolon must separate successive operands.

    Each entry must end with a separator period.

  • The keywords THROUGH and THRU are equivalent.
  • The condition-name entries associated with a particular conditional variable must immediately follow the conditional variable entry. The conditional variable can be any elementary data description entry except the following ones:
    • Another condition-name
    • A RENAMES clause (level-66 item)
    • An item described with USAGE IS INDEX
    • An item described with USAGE POINTER, USAGE PROCEDURE-POINTER, or USAGE FUNCTION-POINTER
  • Condition-names can be specified both at the group level and at subordinate levels within an alphanumeric group, or national group.
  • When the condition-name is specified for an alphanumeric group data description entry:
    • The value of literal-1 (or literal-1 and literal-2) must be specified as an alphanumeric literal or figurative constant.
    • The group can contain items of any usage.
  • When the condition-name is specified for a national group data description entry:
    • The value of literal-1 (or literal-1 and literal-2) must be specified as an alphanumeric literal, a national literal, or a figurative constant.
    • The group can contain only items of usage national, as specified for the GROUP-USAGE clause.
  • When the condition-name is associated with an alphanumeric group data description entry or a national group data description entry :
    • The size of each literal value must not exceed the sum of the sizes of all the elementary items within the group.
    • No element within the group can contain a JUSTIFIED or SYNCHRONIZED clause.
  • Relation tests implied by the definition of a condition-name are performed in accordance with the rules referenced in the table below.

    Table 1. Relation test references for condition-names
    Type of conditional variable Relation condition rules
    Alphanumeric group item Group comparisons
    National group item (treated as elementary data item of class national) National comparisons
    Elementary data item of class alphanumeric Alphanumeric comparisons
    Elementary data item of class national National comparisons
    Elementary data item of class numeric Numeric comparisons
    Elementary data item of class DBCS DBCS comparisons
  • A VALUE clause that specifies a national literal can be associated with a condition-name defined only for a data item of class national.
  • A VALUE clause that specifies a DBCS literal can be associated with a condition-name defined only for a data item of class DBCS.
  • The literals in a condition-name entry for an elementary data item of class national or a national group item must be either national literals or alphanumeric literals, and literal-1 and literal-2 must be of the same class. For alphanumeric groups or elementary data items of other classes, the type of literal must be consistent with the data type of the conditional variable. In the following example:
    • CITY-COUNTY-INFO, COUNTY-NO, and CITY are conditional variables.

      The PICTURE associated with COUNTY-NO limits the condition-name value to a two-digit numeric literal.

      The PICTURE associated with CITY limits the condition-name value to a three-character alphanumeric literal.

    • The associated condition-names are level-88 entries.

      Any values for the condition-names associated with CITY-COUNTY-INFO cannot exceed five characters.

      Because this is an alphanumeric group item, the literal must be alphanumeric.

         05  CITY-COUNTY-INFO.
             88  BRONX                    VALUE "03NYC".
             88  BROOKLYN                 VALUE "24NYC".
             88  MANHATTAN                VALUE "31NYC".
             88  QUEENS                   VALUE "41NYC".
             88  STATEN-ISLAND            VALUE "43NYC".
           10  COUNTY-NO                  PICTURE 99.
               88  KINGS                  VALUE 24.
               88  NEW-YORK               VALUE 31.
               88  RICHMOND               VALUE 43.
           10  CITY                       PICTURE X(3).
               88  BUFFALO                VALUE "BUF".
               88  NEW-YORK-CITY          VALUE "NYC".
               88  POUGHKEEPSIE           VALUE "POK".
         05  POPULATION...
  • A condition-name can be associated with a date, time, or timestamp item. In this case:
    • The condition-name value must be specified as a non-numeric literal.
    • Each condition-name implicitly has the FORMAT characteristics of the conditional variable. Thus, any relation test involving this condition-name is performed in accordance with the rules for comparing items of class date-time.
    • A THROUGH phrase can be specified when a conditional variable is of class date-time. In this case, the time or date of literal-1 must be less than literal-2.
  • If the item is a windowed date field, the following restrictions apply:
    • For alphanumeric conditional variables:
      • Both literal-1 and literal-2 (if specified) must be alphanumeric literals of the same length as the conditional variable.
      • The literals must not be specified as figurative constants.
      • If literal-2 is specified, both literals must contain only decimal digits.
    • If the YEARWINDOW compiler option is specified as a negative integer, literal-2 must not be specified.
    • If literal-2 is specified, literal-1 must be less than literal-2 after applying the century window specified by the YEARWINDOW compiler option. That is, the expanded date value of literal-1 must be less than the expanded date value of literal-2.

For more information about using condition-names with windowed date fields, see Condition-name conditions and windowed date field comparisons.