COBOL Manual for TNS and TNS/R Programs
Language Elements
HP COBOL Manual for TNS and TNS/R Programs—522555-006
3-19
Literals
Simple Nonnumeric Literals
A simple nonnumeric literal is a character-string that has the value of the sequence of
its characters.
char
is an alphanumeric character or a quotation mark ("). If char is a quotation mark,
it must be immediately followed by another quotation mark. Each pair of quotation
marks represents a single embedded quotation mark. A simple nonnumeric literal
can have at most 160 characters, excluding the delimiting quotation marks.
Simple nonnumeric literals follows these rules:
•
The literal must be both preceded and followed by at least one separator.
•
The delimiting 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 literal does not include the second of two consecutive quotation marks that
represent a single, embedded one.
•
All other characters in the literal represent themselves as a part of the literal’s
value and have no other interpretation. Lowercase letters are not equivalent to
their uppercase counterparts. Punctuation characters are not interpreted as
separators.
•
The value of a literal is the ordered sequence of characters in its representation
(excluding the delimiting quotation marks and interpreting a pair of contained
quotation marks as a single quotation mark character). The literal represents a
data item of the alphanumeric category whose value is the value of the literal.
Example 3-5. Nonnumeric Literals
"THIS IS A NONNUMERIC LITERAL"
"This is ANOTHER one. "" IS ONE EMBEDDED QUOTATION MARK"
"You don't need to double apostrophes."
". , ; : ( ) == are not separators in literals."
VST744.vsd
"
char
"