Mainframe storage of numbers question



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Mainframe storage of numbers question

Postby pintu1228 » Wed Mar 22, 2017 9:08 am

Hi everyone,

I just wanted to know what the value -8453.234 looks like in mainframe storage if stored in packed decimal and also if stored in zone decimal.

Can anyone help me understand this??


Thanks
pintu1228
 
Posts: 48
Joined: Mon Mar 23, 2015 12:41 am
Has thanked: 5 times
Been thanked: 0 time

Re: Mainframe storage of numbers question

 

Re: Mainframe storage of numbers question

Postby steve-myers » Wed Mar 22, 2017 10:09 am

In hexadecimal representation
Packed - 8453234D
Zoned - F8F4F5F3F2F3D4

There are other, equally valid representations.

The last byte reflects the "preferred" sign for a negative number.

You can find more information through this link.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Mainframe storage of numbers question

Postby Robert Sample » Wed Mar 22, 2017 2:31 pm

One thing to note is that the decimal point itself is NOT stored in either zoned decimal nor packed decimal -- it is an implied decimal point only. If you need the decimal point stored, you use the "numeric edited" form of the PICTURE clause in COBOL.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Mainframe storage of numbers question

Postby enrico-sorichetti » Wed Mar 22, 2017 2:52 pm

the manual
z/Architecture Principles of Operation

available here ( You might need to register to download )
https://www-304.ibm.com/support/docview ... c500428f9a

will tell all You might want to know about internal number representation
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2644
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post