Rules for Literal Values
- Wherever a literal is specified, a figurative constant may be substituted.
- If the item is numeric, all VALUE clause literals must be numeric. If the literal defines the value of a Working-Storage item, the literal is aligned according to the rules for numeric moves, with one additional restriction: The literal must not have a value that requires truncation of nonzero digits. If the literal is signed, the associated PICTURE character-string must contain a sign symbol (S).
- With an exception, numeric literals in a VALUE clause of an item must
have a value that is within the range of values indicated by the PICTURE clause
for that item. For example, for a PICTURE of 99PPP, the literal must fall
within the range of 1 000 through 99 000, or it must be zero. For
a PICTURE of PPP99, the literal must fall within the range of 0.000 00
through 0.000 99.
The exceptions are the following:
- Data items described with usage COMP-5 that do not have a picture symbol P in their PICTURE clause.
- When the *NOSTDTRUNC compiler option is in effect, data items described with usage BINARY or COMP-4 that do not have a picture symbol P in their PICTURE clause.
A VALUE clause for these items can have a value up to the capacity of the native binary representation.
- If the item is a group item, or an elementary alphabetic, alphanumeric,
alphanumeric-edited, or numeric-edited item, all VALUE clause literals must
be nonnumeric literals. The literal is aligned according to the alignment
rules, with one additional restriction: the number of characters in the literal
must not exceed the size of the item.
IBM Extension
IBM Extension If the item is Boolean, the VALUE clause must be a Boolean literal. End of IBM Extension
End of IBM Extension - The functions of the editing characters in a PICTURE clause are ignored in determining the initial appearance of the item described. However, editing characters are included in determining the size of the item. Therefore, any editing characters must be included in the literal. For example, if the item is defined as PICTURE +999.99 and the value is to be +12.34, then the VALUE clause should be specified as VALUE '+012.34'.
- A maximum of 32 767 bytes can be initialized by means of a single VALUE clause. A maximum of 65 472 bytes can be initialized by all of the VALUE clauses contained within a single program.