COBOL Manual for TNS and TNS/R Programs
Language Elements
HP COBOL Manual for TNS and TNS/R Programs—522555-006
3-21
Literals
National literals follow these rules:
•
The letter N or n and the quotation marks are part of the character-string that
represents the literal; they are not part of the value of the literal.
•
HP COBOL accepts only the double quotation mark ("), not the apostrophe ('), as a
quotation mark.
•
The value of a national literal is the ordered sequence of characters in its
representation, excluding the delimiting quotation marks. The maximum number of
characters allowed on a line depends on the column in which the literal begins.
•
The literal represents a data item of the national category whose value is the value
of the literal.
•
Punctuation characters appearing within a character-string that represents a
national literal are components of its value and are never interpreted as separators.
Each character is represented internally as 2 bytes.
In general, you can use a national literal anywhere you can use a nonnumeric literal.
Exceptions are:
•
A national literal cannot be compared to a nonnumeric or numeric literal or to a
data item not defined as national. Compare national literals only to other national
literals or national data items.
•
A national literal cannot be specified in these paragraphs, statements, phrases, or
clauses:
°
SPECIAL-NAMES paragraph
°
PADDING clause of the SELECT statement
°
RECEIVE-CONTROL paragraph
°
INITIALIZE statement when the REPLACING phrase is used
°
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.