OSVSVSC2MFXOPEN 

COMPUTATIONAL-3 ANS85 or PACKED-DECIMAL Format

This format, commonly called binary-coded decimal format, represents numeric data items in radix 10, but with each digit of the value held in only one half of one computer character, as described in the table below. The sign is held in a separate trailing digit (half-character) position; that is, at the right-hand or least significant end of the item.

MF Any unused half bytes are set to zero.

Table 1. COMPUTATIONAL-3 Digit Representation
Digit Value Digit Representation in Hexadecimal
Left Half-Character (odd digit) Right Half-Character (even digit)
0 x"00" x"00"
1 x"10" x"01"
2 x"20" x"02"
3 x"30" x"03"
4 x"40" x"04"
5 x"50" x"05"
6 x"60" x"06"
7 x"70" x"07"
8 x"80" x"08"
9 x"90" x"09"
OSVSVSC2MFXOPEN Note: Count even and odd starting from the right.

The table immediately below shows the sign digit used for COMPUTATIONAL-3. Storage requirements for this format depend only on the number of "9s" in the PICTURE clause of the data item as shown in the second table.

Table 2. COMPUTATIONAL-3 Sign Digit Representation
Sign Convention in the PICTURE Clause Sign of Data Item Value Sign Half-character, in Hexadecimal
Unsigned n/a x"0F"
Signed + x"0C"
Signed - x"0D"
Table 3. Numeric Data Storage for the COMP(UTATIONAL)-3 ANS85 or PACKED-DECIMAL PICTURE Clause.
Bytes Required Number of Digits (Signed or Unsigned)
1 1
2 2-3
3 4-5
4 6-7
5 8-9
6 10-11
7 12-13
8 14-15
9 16-17
10 18-19
11 20-21
12 22-23
13 24-25
14 26-27
15 28-29
16 30-31
17 32-33
18 34-35
19 36-37
20 38

Example:

  1. For COMPUTATIONAL-3 and PICTURE 9999, the number +1234 would be stored as follows:


    Diagram depicting storage for the number +1234 for COMPUTATIONAL-3 and PICTURE 9999

    where F represents the non-printing plus sign.

  2. For COMPUTATIONAL-3 and PICTURE S9999, the number + 1234 would be stored as follows:


    Diagram depicting storage for the number +1234 for COMPUTATIONAL-3 and PICTURE S9999

    where C represents the plus sign.

  3. For COMPUTATIONAL-3 and PICTURE S9999, the number -1234 would be stored as follows:


    Diagram depicting storage for the number -1234 for COMPUTATIONAL-3 and PICTURE 9999

    where D represents the minus sign.

The SYNCHRONIZED clause (with or without the LEFT or RIGHT phrase) has no effect on COMPUTATIONAL-3 data declarations.