Figurative Constants

Figurative constants are reserved words that name and refer to specific constant values.The reserved words for figurative constants and their meanings are:

ZERO/ZEROS/ZEROES
Represents one of the following, depending on the context:
  • The numeric value zero (0)
  • One or more occurrences of the nonnumeric character zero (0)
  • IBM Extension
    IBM Extension The Boolean value B"0" End of IBM Extension
    End of IBM Extension
SPACE/SPACES
Represents one or more blanks or spaces;treated as a nonnumeric literal. SPACES represent one or more double-byte spaces when used with DBCS data items. SPACES represent one or more single-byte UCS-2 spaces when used with national data items.
HIGH-VALUE/HIGH-VALUES
Represents one or more occurrences of the character that has the highest ordinal position in the collating sequence used. For the NATIVE and EBCDIC collating sequences, the character is X'FF'; for the STANDARD-1 and STANDARD-2 collating sequences, the character is X'07'; for other collating sequences, the actual character used depends on the collating sequence. HIGH-VALUE is treated as a nonnumeric literal.
LOW-VALUE/LOW-VALUES
Represents one or more occurrences of the character that has the lowest ordinal position in the collating sequence used. For the NATIVE, EBCDIC, STANDARD-1, and STANDARD-2 collating sequences, the character is X'00'; for other collating sequences, the actual character used depends on the collating sequence. LOW-VALUE is treated as a nonnumeric literal.
QUOTE/QUOTES
Represents one or more occurrences of the quotation mark character and must be nonnumeric. QUOTE, or QUOTES cannot be used in place of a quotation mark or an apostrophe to enclose a nonnumeric literal.
IBM Extension

IBM Extension When APOST is specified as a compiler option, the figurative constant QUOTE has the EBCDIC value of an apostrophe. End of IBM Extension

End of IBM Extension
ALL literal
Represents one or more occurrences of the string of characters comprising the literal. The literal must be a nonnumeric literal or a figurative constant other than the ALL literal.
When a figurative constant other than ALL literal is used, the word ALL is redundant and is used for readability only. The figurative constant ALL literal must not be used with the INSPECT, STOP, or STRING statements.
Note: The figurative constant ALL literal, when associated with a numeric or numeric-edited item and when the length of the literal is greater than one, is an obsolete element and is to be deleted from the next revision of the ANSI Standard.
IBM Extension

IBM Extension The literal used in an ALL literal can be a Boolean literal, DBCS literal, or national literal. End of IBM Extension

End of IBM Extension
IBM Extension
IBM Extension
NULL/NULLS
Represents a value used to indicate that a data item defined with the USAGE IS POINTER clause, USAGE IS PROCEDURE-POINTER clause, ADDRESS OF phrase, or ADDRESS OF special register does not contain a valid address. NULL can be used only where explicitly allowed in the syntax format.

In the ILE COBOL language, a value of NULL is undefined.

End of IBM Extension
End of IBM Extension
The singular and plural forms of ZERO, SPACE, HIGH-VALUE, LOW-VALUE, QUOTE, and NULL are equivalent, and may be used interchangeably. For example, if DATA-NAME-1 is a 5-character data item, each of the following statements will fill DATA-NAME-1 with five spaces:
MOVE SPACE TO DATA-NAME-1
MOVE SPACES TO DATA-NAME-1
MOVE ALL SPACES TO DATA-NAME-1

A figurative constant can be used wherever ‘literal’ appears in a format, except where explicitly prohibited. When a numeric literal appears in a format, only the figurative constant ZERO can be used. Figurative constants are not allowed as function arguments except in an arithmetic expression, where they are arguments to a function.

IBM Extension

IBM Extension The figurative constant ZERO can be used as a Boolean literal. End of IBM Extension

End of IBM Extension
The length of a figurative constant depends on the context of the program. The following rules apply:
  • When a figurative constant is associated with a data item (for example, when it is moved to or compared with another item), the length of the figurative constant character-string is equal to one (1) or to the number of character positions in the associated data item, whichever is greater.
  • When a figurative constant, other than the ALL literal, is not associated with another data item (for example, in a STOP, STRING, or UNSTRING statement), the length of the character-string is one (1) character.