Previous Topic Next topic Print topic


The VALUE Clause

Format 1 - Additional Syntax Rules

  1. The VALUE clause is prohibited for external floating-point data items.

Format 2

The WHEN SET TO FALSE phrase is supported, as described in the section The VALUE Clause.

Format 3

The VALUE clause may be used to initialize the elements of a table.

Format 4


*

Syntax Rules

Format 4

  1. Format 3 of the VALUE clause must be used only in the Working-Storage section.
  2. All numeric literals in a VALUE clause of an item must have a value which is within the range of values indicated by the associated PICTURE clause, and must not have a value which would require truncation of non-zero digits.
  3. Nonnumeric literals in a VALUE clause of an item must not exceed the size indicated by the associated PICTURE clause.
  4. If the VALUE clause is used in an entry at the group level, the literal must be a figurative constant or a nonnumeric literal, and the group area is initialized without consideration for the individual elementary or group items contained within this group. The VALUE clause must not be stated at the subordinate levels within this group.
  5. The VALUE clause must not be specified for a group item containing items subordinate to it with descriptions including JUSTIFIED or USAGE (other than USAGE IS DISPLAY).
  6. When format 3 is specified, the data description entry must contain an OCCURS clause or be subordinate to a data description entry that contains an OCCURS clause.
  7. Subscript-1 must be a numeric literal that is an integer. If all subscripts have the value 1, no subscripts need be specified; otherwise, all subscripts required to reference an individual element in a table must be specified.
  8. The number of table elements to be initialized is determined as follows:
    1. If integer-1 is not specified, it is the number of repetitions of literal-2.
    2. If integer-1 is specified, it is the number of repetitions of literal-2 times integer-1.

    The number of table elements to be initialized must not exceed the maximum number of occurrences in the table from the point of reference to the end of the table.

  9. If multiple format 3 VALUE clauses are specified in an entry, the TO END phrase may be specified only once.

General Rules

Format 4

  1. All formats of the VALUE clause can be used in one table.
  2. Within the same data description entry, if more than one VALUE clause references the same table element, the value defined by the last specified VALUE clause in the data description entry is assigned to the table element.
  3. A format 3 VALUE clause initializes a table element to the value of literal-2. The table element initialized is identified by subscript-1. Consecutive table elements are initialized, in turn, to the successive occurrences of the value of literal-2. Consecutive table elements are referenced by augmenting by 1 the subscript that represents the least inclusive dimension of the table. When any reference to a subscript, prior to augmenting it, is equal to the maximum number of occurrences specified by its corresponding OCCURS clause, that subscript is set to 1 and the subscript for the next most inclusive dimension of the table is augmented by 1.
  4. If the REPEATED phrase is specified, all occurrences of literal-2 are reused, in the order specified.

    If the TO END phrase is specified, this reuse occurs until the end of the table is reached.

    If the integer-1 TIMES phrase is specified, the occurrences of literal-2 are reused, in the order specified, integer-1 times.

    If the REPEATED phrase is not specified, the occurrences of literal-2 are used, in the order specified, only once.

  5. If a VALUE clause is specified in a data description entry of a data item which is associated with a variable-occurrence data item, the initialization of the data item behaves as if the value of the data item referenced by the DEPENDING ON phrase in the OCCURS clause specified for the variable-occurrence data item is set to the maximum number of occurrences as specified by that OCCURS clause. A data item is associated with a variable-occurrence data item in any of the following cases:
    1. It is a group data item which contains a variable-occurrence data item.
    2. It is a variable-occurrence data item.
    3. It is a data item that is subordinate to a variable-occurrence data item.
  6. The VALUE clause must not conflict with other clauses in the data description of the item or in the data description within the hierarchy of the item. The following rules apply:

    If the category of the item is numeric, all literals in the VALUE clause must be numeric. The literal is aligned in the data item according to the standard alignment rules.

    If the category of the item is alphabetic or alphanumeric, all literals in the VALUE clause must be nonnumeric literals. The literal is aligned in the data item as if the data item had been described as alphanumeric.

    Initialization is not affected by any BLANK WHEN ZERO or JUSTIFIED clause that was specified.

Previous Topic Next topic Print topic