The following tables show the internal representation of numeric items.
The following table shows the internal representation of numeric items in native data format. Numeric items that have USAGE NATIONAL are represented in UTF16-LE (little-endian) encoding. Assume that the BINARY(NATIVE), CHAR(NATIVE), and FLOAT(NATIVE) compiler options are in effect.
| Numeric type | PICTURE and USAGE and optional SIGN clause | Value | Internal representation |
|---|---|---|---|
| External decimal | PIC S9999 DISPLAY | + 1234 | 31 32 33 34 |
| - 1234 | 31 32 33 74 | ||
| 1234 | 31 32 33 34 | ||
| PIC 9999 DISPLAY | 1234 | 31 32 33 34 | |
| PIC 9999 NATIONAL | 1234 | 31 00 32 00 33 00 34 00 | |
| PIC S9999 DISPLAY
SIGN LEADING |
+ 1234 | 31 32 33 34 | |
| - 1234 | 71 32 33 34 | ||
| PIC S9999 DISPLAY
SIGN LEADING SEPARATE |
+ 1234 | 2B 31 32 33 34 | |
| - 1234 | 2D 31 32 33 34 | ||
| PIC S9999 DISPLAY
SIGN TRAILING SEPARATE |
+ 1234 | 31 32 33 34 2B | |
| - 1234 | 31 32 33 34 2D | ||
| PIC S9999
NATIONAL
SIGN LEADING SEPARATE |
+ 1234 | 2B 00 31 00 32 00 33 00 34 00 | |
| - 1234 | 2D 00 31 00 32 00 33 00 34 00 | ||
| PIC S9999
NATIONAL
SIGN TRAILING SEPARATE |
+ 1234 | 31 00 32 00 33 00 34 00 2B 00 | |
| - 1234 | 31 00 32 00 33 00 34 00 2D 00 | ||
| Binary | PIC S9999 BINARY
PIC S9999 COMP PIC S9999 COMP-4 |
+ 1234 | D2 04 |
| - 1234 | 2E FB | ||
| PIC S9999 COMP-5 | + 123451 | 39 30 | |
| - 123451 | C7 CF | ||
| PIC 9999 BINARY
PIC 9999 COMP PIC 9999 COMP-4 |
1234 | D2 04 | |
| PIC 9999 COMP-5 | 600001 | 60 EA | |
| Internal decimal | PIC S9999
PACKED-DECIMAL
PIC S9999 COMP-3 |
+ 1234 | 01 23 4C |
| - 1234 | 01 23 4D | ||
| PIC 9999 PACKED-DECIMAL
PIC 9999 COMP-3 |
1234 | 01 23 4C | |
| Internal floating point | COMP-1 | + 1234 | 00 40 9A 44 |
| - 1234 | 00 40 9A C4 | ||
| COMP-2 | + 1234 | 00 00 00 00 00 48 93 40 | |
| - 1234 | 00 00 00 00 00 48 93 C0 | ||
| External floating point | PIC +9(2).9(2)E+99 DISPLAY | + 12.34E+02 | 2B 31 32 2E 33 34 45 2B 30 32 |
| - 12.34E+02 | 2D 31 32 2E 33 34 45 2B 30 32 | ||
| PIC +9(2).9(2)E+99 NATIONAL | + 12.34E+02 | 2B 00 31 00 32 00 2E 00
33 00
34 00 45 00 2B 00 30 00 32 00 |
|
| - 12.34E+02 | 2D 00 31 00 32 00 2E 00
33 00
34 00 45 00 2B 00 30 00 32 00 |
||
|
|||
The following table shows the internal representation of numeric items in zSeries data format. Numeric items that have USAGE NATIONAL are represented in UTF16-LE encoding. Assume that the BINARY(S390), CHAR(EBCDIC), and FLOAT(HEX) compiler options are in effect.
| Numeric type | PICTURE and USAGE and optional SIGN clause | Value | Internal representation |
|---|---|---|---|
| External decimal | PIC S9999 DISPLAY | + 1234 | F1 F2 F3 C4 |
| - 1234 | F1 F2 F3 D4 | ||
| 1234 | F1 F2 F3 C4 | ||
| PIC 9999 DISPLAY | 1234 | F1 F2 F3 F4 | |
| PIC 9999 NATIONAL | 1234 | 31 00 32 00 33 00 34 00 | |
| PIC S9999 DISPLAY
SIGN LEADING |
+ 1234 | C1 F2 F3 F4 | |
| - 1234 | D1 F2 F3 F4 | ||
| PIC S9999 DISPLAY
SIGN LEADING SEPARATE |
+ 1234 | 4E F1 F2 F3 F4 | |
| - 1234 | 60 F1 F2 F3 F4 | ||
| PIC S9999 DISPLAY
SIGN TRAILING SEPARATE |
+ 1234 | F1 F2 F3 F4 4E | |
| - 1234 | F1 F2 F3 F4 60 | ||
| PIC S9999
NATIONAL
SIGN LEADING SEPARATE |
+ 1234 | 2B 00 31 00 32 00 33 00 34 00 | |
| - 1234 | 2D 00 31 00 32 00 33 00 34 00 | ||
| PIC S9999
NATIONAL
SIGN TRAILING SEPARATE |
+ 1234 | 31 00 32 00 33 00 34 00 2B 00 | |
| - 1234 | 31 00 32 00 33 00 34 00 2D 00 | ||
| Binary | PIC S9999 BINARY
PIC S9999 COMP PIC S9999 COMP-4 |
+ 1234 | 04 D2 |
| - 1234 | FB 2E | ||
| PIC S9999 COMP-5 | + 123451 | 39 30 | |
| - 123451 | C7 CF | ||
| PIC 9999 BINARY
PIC 9999 COMP PIC 9999 COMP-4 |
1234 | 04 D2 | |
| PIC 9999 COMP-5 | 600001 | 60 EA | |
| Internal decimal | PIC S9999
PACKED-DECIMAL
PIC S9999 COMP-3 |
+ 1234 | 01 23 4C |
| - 1234 | 01 23 4D | ||
| PIC 9999 PACKED-DECIMAL
PIC 9999 COMP-3 |
1234 | 01 23 4C | |
| Internal floating point | COMP-1 | + 1234 | 43 4D 20 00 |
| - 1234 | C3 4D 20 00 | ||
| COMP-2 | + 1234 | 43 4D 20 00 00 00 00 00 | |
| - 1234 | C3 4D 20 00 00 00 00 00 | ||
| External floating point | PIC +9(2).9(2)E+99 DISPLAY | + 12.34E+02 | 4E F1 F2 4B F3 F4 C5 4E F0 F2 |
| - 12.34E+02 | 60 F1 F2 4B F3 F4 C5 4E F0 F2 | ||
| PIC +9(2).9(2)E+99 NATIONAL | + 12.34E+02 | 2B 00 31 00 32 00 2E 00
33 00
34 00 45 00 2B 00 30 00 32 00 |
|
| - 12.34E+02 | 2D 00 31 00 32 00 2E 00
33 00
34 00 45 00 2B 00 30 00 32 00 |
||
|
|||