Examples: numeric data and internal representation
The following tables show the internal representation of numeric items.
The following table shows the internal representation of numeric items for binary data types.
Numeric type | PICTURE and USAGE and
optional SIGN clause |
Value | Internal representation |
---|---|---|---|
Binary | PIC S9999 BINARY PIC S9999 COMP PIC S9999 COMP-4 |
+ 1234 |
D2 04
|
- 1234 |
2E FB
|
||
PIC
S9999 COMP-5 |
+ 12345 1 |
39 30
|
|
- 12345 1 |
C7 CF
|
||
PIC 9999 BINARY PIC 9999 COMP PIC 9999 COMP-4 |
1234 |
D2 04
|
|
PIC 9999 COMP-5 |
60000 1 |
60 EA
|
|
|
The
following table shows the internal representation
of numeric items in native data format. Assume that the 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 |
||
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 IBM Z® host data format. Assume that the
CHAR(EBCDIC)
and FLOAT(BE)
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 |
00 31 00 32 00 33 00 34 |
|
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 |
00 2B 00 31 00 32 00 33 00 34 |
|
- 1234 |
00 2D 00 31 00 32 00 33 00 34 |
||
PIC S9999 NATIONAL SIGN TRAILING SEPARATE |
+ 1234 |
00 31 00 32 00 33 00 34 00 2B |
|
- 1234 |
00 31 00 32 00 33 00 34 00 2D |
||
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 |
00 2B 00 31 00 32 00 2E 00 33 00 34 00 45 00 2B 00 30 00 32 |
|
- 12.34E+02 |
00 2D 00 31 00 32 00 2E 00 33 00 34 00 45 00 2B 00 30 00 32 |