COBOL Manual for TNS/E Programs (H06.03+)

Language Elements
HP COBOL Manual for TNS/E Programs520347-003
3-20
Literals
°
INSPECT statement
°
As literal-1 or literal-2 of the REPLACING phrase of a COPY
statement
If national literals and national data items are used for items in a STRING
statement (delim-1, delim-2, result, or delim-store ), all the items must be
national literals or national data items.
Figurative Constants
A figurative constant is a character-string that has a value the compiler generates from
one of the reserved words in the first column of Table 3-5. The value it generates
depends on the context in which the figurative constant appears.
In general, you can use a figurative constant wherever the syntax rules of the language
require or permit a literal. The exceptions to this rule are:
When the literal must be a numeric literal, the only acceptable figurative constant
is [ALL] ZERO[[E]S] (which generates the numeric value 0). The other forms of
figurative constant always generate a nonnumeric value; therefore, such forms are
not acceptable when the context requires a numeric value.
There are certain contexts in which you cannot use figurative constants whose
source form includes the word ALL. When this is the case, the usage
considerations for that particular language element’s syntax mention the usage
restriction.
The COBOL language includes several constructs where a literal cannot be any
figurative constant. When this is the case, the usage considerations for that
particular language element’s syntax mention the usage restriction.
When SPACE, QUOTE, or ZERO is applied to a national data item, the class of the
figurative literal is national. The 2-byte value of the national character set that
corresponds to SPACE, QUOTE, or ZERO when the program is compiled is used.
For LOW-VALUES and HIGH-VALUES, the highest and lowest positions in the
collating sequence are assumed.
When a figurative constant represents a nonnumeric or national value, that value is a
string of one or more characters. The compiler determines the length of the string
according to these rules:
When you associate a figurative constant with a data item (for example, by moving
the figurative constant to the data item or by comparing them or using the figurative
constant in a VALUE clause), the compiler repeats the figurative constant value
character by character until its size equals or exceeds the size of the data item.
The compiler then truncates the resultant string from the right end until it has the
same number of character positions as the associated data item. This happens
prior to and independently of the application of any JUSTIFIED clause for the data
item.