Reputation: 181
I'm searching how to visualize and read data manually which is declared like this:
04 DATE PICTURE 9(9) COMPUTATIONAL-3.
One of my colleagues said to me to put HEX ON
When I put the command HEX ON, I had this
00936
2100F
Can anyone explain to me how to read this?
Upvotes: 0
Views: 319
Reputation: 8134
HEX on simply displays the EBCDIC** hexadecimal values of the data being displayed. As it takes 2 bytes for each character, the hex values are stacked vertically under the character being displayed e.g.:
This is some data 123456789
E88A48A4A998488A84FFFFFFFFF444444
389209202645041310123456789000000
So the word 'This' consists of the hex values E3 88 89 A2. x'40' is a space. Other common, easily-remembered values are x'F0'-x'F9' for the characters 0-9.
The data in your example should be read as the hex string x'0201990306F'. If viewed in an editor, the editor will try and render this as readable characters if possible, but that doesn't mean that that data is supposed to be text.
** The character encoding used on the mainframe - pronounced 'ebsedik' - other platforms use ASCII.
Upvotes: 0
Reputation: 10775
COMPUTATIONAL-3, or COMP-3, or Packed-Decimal, is numeric data stored in a Binary Coded Decimal format. Each digit occupies 4 bits (sometimes called a nibble or nybble) in a byte. The last nibble stores the sign. On an IBM mainframe, A, C, E, and F are positive, B and D are negative. C and D are sometimes referred to as "preferred sign" and F is often referred to as "unsigned" which is effectively positive.
The default display when you turn HEX ON in ISPF is to show you the nibbles for each byte, stacked on top of each other, below the actual data.
The value of the field you're looking at is +020190603 which, if you look at it the right way, is June 3, 2019.
Why would someone store a date in this format? Because it only takes 5 bytes instead of 8. If you're storing millions of these, that space savings adds up, and at one time programmers actually spent time looking for places to save a byte here and a byte there because disk space was expensive.
Upvotes: 3