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

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

When literal-1 and literal-2 are DBCS literals, the range of DBCS values specified by the THROUGH phrase is based on the binary collating sequence of the hexadecimal values of the DBCS characters.

When literal-1 and literal-2 are national literals, the range of national character values specified by the THROUGH phrase is based on the binary collating sequence of the hexadecimal values of the national characters represented by the literals.

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.

Start of change WHEN SET TO FALSE End of change
Start of changeAllows specification of a FALSE condition value. This value is moved to the associated conditional variable when the SET TO FALSE statement is executed for the associated condition-name.End of change
Start of change literal-3 End of change
Start of changeWhen a condition-name is referenced in a SET TO FALSE statement, the value of literal-3 from the FALSE phrase is placed in the associated conditional variable.
Note: The true values of a conditional variable are all the values associated with its condition-names, and all other values are false values. The WHEN SET TO FALSE phrase specifies just one of possibly many false values. The purpose is to define a single value to be used by the SET TO FALSE statement. When a condition-name condition is tested, all the non-true values give a false result, not just the one false value defined by the WHEN SET TO FALSE phrase.
End of change

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, USAGE FUNCTION-POINTER, or USAGE OBJECT REFERENCE
  • 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.

    Start of change
    
         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  DUTCHESS               VALUE 14
                   WHEN FALSE IS                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...
    
    End of change