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

Language Elements
HP COBOL Manual for TNS/E Programs520347-003
3-16
Literals
Decimal numeric literals follow these rules:
When a decimal numeric literal appears in a context where its value is assumed to
be a sequence of characters, its size is equal to the number of digits in its
representation.
A sign character (+ or -) has no effect on the size of a literal. Absence of a sign
signifies a positive number.
COBOL does not permit the decimal point as the rightmost (last) character;
HP COBOL relaxes this restriction somewhat:
°
If the apparent last character of a numeric literal qualifies as a decimal point
and the immediately following character is not a space (but is a semicolon,
comma, or right parenthesis), the compiler interprets that last character as the
decimal point.
°
If the apparent last character qualifies as a decimal point but the immediately
following character is a space, the compiler interprets that last character and
the space together as the separator that follows the literal.
The compiler interprets a decimal point as an assumed decimal point; that is, the
character is not present in the value even if the context of the literal implies that the
value is represented as a sequence of characters.
A decimal numeric literal that has no decimal point is an integer.
Hexadecimal Numeric Literals
Example 3-2. Integer Decimal Numeric Literals
+601
-234116
0
15
1234. , (an integer followed by a period separator and a comma
separator)
Example 3-3. Noninteger Decimal Numeric Literals
+601.1
89.6
0.0051
-.1
1234., (a noninteger followed by a comma separator)
VST612.vsd
"
H
hex-digit hex-digit
"
nsns ns
ns
ns