Previous Topic Next topic Print topic


DISPLAY Format

The COBOL digit characters from 0 through 9 that represent the number value are held in radix 10, one digit character per byte of computer storage. This is the standard data format of the COBOL language.

If the data item is signed and the sign is not specified as SEPARATE (see the topic The SIGN Clause and the rules for the NUMERIC SIGN clause in the topic The Special-Names Paragraph) the numeric sign is incorporated into either the leading or trailing digit, according to the LEADING or TRAILING phrase in the SIGN clause. Signed data is incorporated into the requisite digit as shown in Table 4 below. (Effectively, bit 6 (hexadecimal value "40" ) of the character is set from 0 to 1 if the number has a negative value.)

If the data item is signed and the sign is specified as SEPARATE, then the sign is held as a separate single COBOL character, additional to the digits, either plus (+) or minus (-) as necessary.

If the data item is signed and no SIGN clause applies, the numeric sign is incorporated into the trailing digit, unless the NUMERIC SIGN clause is specified in the Special-Names paragraph. If the SIGN clause is specified in a data description entry, the NUMERIC SIGN clause, if specified, is ignored for that entry.

In the following table, the numbers in brackets represent the hexadecimal encoding for the COBOL character. On some systems, the encoding can be varied by the CHARSET and SIGN Compiler directives.

Table 1. DISPLAY Non-SEPARATE Sign-Digit Characters
Leading or trailing value digit before sign incorporation Sign Digit Character for:
Positively-signed values Negatively-signed values
Charset (ASCII) Charset (EBCDIC) Charset (ASCII) Charset (EBCDIC)
Sign (ASCII) Sign (EBCDIC) Sign (EBCDIC) Sign (ASCII) Sign (EBCDIC) Sign (EBCDIC)
0 0(30) {(7B) {(C0) p(70) }(7D) }(D0)
1 1(31) A(41) A(C1) q(71) J(4A) J(D1)
2 2(32) B(42) B(C2) r(72) K(4B) K(D2)
3 3(33) C(43) C(C3) s(73) L(4C) L(D3)
4 4(34) D(44) D(C4) t(74) M(4D) M(D4)
5 5(35) E(45) E(C5) u(75) N(4E) N(D5)
6 6(36) F(46) F(C6) v(76) O(4F) O(D6)
7 7(37) G(47) G(C7) w(77) P(50) P(D7)
8 8(38) H(48) H(C8) x(78) Q(51) Q(D8)
9 9(39) I(49) I(C9) y(79) R(52) R(D9)

Storage character position requirements for DISPLAY data items are thus equal to the number of "9"s in the PICTURE clause plus one if the sign is specified as SEPARATE. The SYNCHRONIZED clause has no effect on DISPLAY format data declarations.

Previous Topic Next topic Print topic