COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
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.
Example 7 Integer Decimal Numeric Literals
+601
34116
0
15
1234. , (an integer followed by a period separator and a comma
separator)
Example 8 Noninteger Decimal Numeric Literals
+601.1
89.6
0.0051
-.1
1234., (a noninteger followed by a comma separator)
Hexadecimal Numeric Literals
hex-digit
is one of the characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, a, b, c, d, e, f. The
maximum number of hex-digits in a hexadecimal numeric literal is 16 (eight pairs).
A hexadecimal numeric literal is considered an unsigned integer. It can appear anywhere that a
decimal numeric literal can appear.
Character-Strings 71










