Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
krbabu

New User

Joined: 20 Feb 2004
Posts: 57

 Posted: Fri Feb 20, 2004 12:35 pm    Post subject: Diff between Packed decimal and binary decimal formats Hi , Can anybody tell me the differance between the packed decimal format and the binary decimal format.

mcmillan

Joined: 18 May 2003
Posts: 1200
Location: India

 Posted: Fri Feb 20, 2004 2:32 pm    Post subject: Re Dear, Binary Decimal is what you are defining as "COMP" and packed decimal is what you are thinking s "COMP-3" In computational format data are stored in binary format and it occupies half / full / double word depending on the size of data. In comp-3 format data are stored in 8421 decimal format and each digit occupies half-a-byte.
krbabu

New User

Joined: 20 Feb 2004
Posts: 57

 Posted: Mon Feb 23, 2004 12:08 pm    Post subject: can u give one example Hi Millan, Thanks to your valuabel guidance, Can u give the example for the following number. How can the number 126 stored in two formats , both the comp and comp-3.Can explain the internal format for 126 in both the cases.
mcmillan

Joined: 18 May 2003
Posts: 1200
Location: India

 Posted: Mon Feb 23, 2004 12:18 pm    Post subject: Re Sure, 126 in COMP: 0000 0000 0111 1110 (2 bytes) 126 IN COMP-3: 0001 0100 0110 1111 (2 bytes)
krbabu

New User

Joined: 20 Feb 2004
Posts: 57

 Posted: Thu Feb 26, 2004 1:30 pm    Post subject: Thanks millan, i am in confusion about, how to mention the digits in comp-3 format.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Sat Feb 28, 2004 6:53 am    Post subject: Hi Ravindra, If you saw the 2 representations that McMillan presented in a dump they would look like this: PIC 9(003) COMP-3 VALUE 126 ===> 126F PIC 9(003) COMP VALUE 126 ===> 007E The minus values might surprise you: PIC S9(003) COMP-3 VALUE -126 ===> 126D PIC S9(003) COMP VALUE -126 ===> FF82 If I did the math correctly. Regards, Jack.
mcmillan

Joined: 18 May 2003
Posts: 1200
Location: India

Posted: Sat Feb 28, 2004 9:32 am    Post subject: Re

Hai,

Yes. It's exactly right Jack.

 Quote: i am in confusion about, how to mention the digits in comp-3 format.

Your Query is 126. hence I assumed it's unsigned positive.

In Comp-3 each digit occupies half-a-byte. Hence we need 1+1/2 bytes for 126. And also COMP-3 requires a half byte for sign digit. (Even if it's unsigned)

Hence totally we need 2 bytes.

Let's take 1, the equivalent 8421 code is: 0001
8421 code for 2 is: 0010
For 6 IT'S: 0110

Hence we get 0001 0010 0110

For Unsigned numeric the last nipple is: F
For Signed positive: C
For Negative: D

Equivalent 8421 code for F is : 1111

Hence our result is: 0001 0010 0110 1111

Is it Ok?
philipraju
Warnings : 1

New User

Joined: 16 Apr 2006
Posts: 29

 Posted: Sun Apr 16, 2006 12:47 pm    Post subject: hi, im in small confusion in memory usage of comp,comp1,comp2.pls can any body explains by using same value for all.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us