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

Author Message
nandakumar
Warnings : 2

New User

Joined: 05 May 2005
Posts: 50

 Posted: Tue Jun 07, 2005 8:52 am    Post subject: What does packed decimal digits means. Hi, can anybody plz tell me: In cobol programming if we define a numeric data in comp-3 it is stored interenally as packed decimal digits.is it right,then what does packed decimal digits means.

j_prameela2000

New User

Joined: 01 Jun 2005
Posts: 28
Location: Chennai

 Posted: Tue Jun 07, 2005 2:28 pm    Post subject: Re: What does packed decimal digits means. Yes u are correct. One to 16 bytes may be used to store a sequence of decimal digits representing an arithmetic value. A pattern of four bits is defined for each decimal digit. Since a byte consists of eight bits, upto two decimal digits may be packed into one byte and one half of a byte is reserved for tyhe sign + or - of the number. Eg. to represent +5, one byte is needed which is denoted as 5+ where 5 holds the binary value 0101 and + holds the binary bit pattern value 1100.
senthilkumar selvaraju

New User

Joined: 30 May 2005
Posts: 16

 Posted: Wed Jun 08, 2005 4:44 pm    Post subject: packed decimal means hexa decimal value.
Sangram

New User

Joined: 08 Jun 2005
Posts: 7

 Posted: Wed Jun 08, 2005 5:00 pm    Post subject: Re: What does packed decimal digits means. [color=darkblue]Packed decimal is nothing but the hexadecimal equivalent of the data that you have entered. It will not be visible when the file having packed decimal data is opened in edit mode unless you use a HEX ON. It is used to provide optimum storage. A variable with PIC X(5) COMP-3 will occupy only 3 bytes in the storage memory.
subhasis_50

Moderator

Joined: 09 Mar 2005
Posts: 363
Location: Earth

 Posted: Wed Jun 08, 2005 5:14 pm    Post subject: Re: What does packed decimal digits means. Hi, You will get more clear ans from the following link http://www.ibmmainframes.com/viewtopic.php?t=3147&highlight=comp3
senthilkumar selvaraju

New User

Joined: 30 May 2005
Posts: 16

 Posted: Thu Jun 09, 2005 11:57 am    Post subject: Hi sangram, Alphanumeric picture clause is not possible in comp-3 usage. As per your example, you mention that it takes 3 bytes storage. it's wrong. it takes 4 bytes because 3 bytes for value and one byte for sign. If you feel and wrong in my answer, please send me
frame_kan

New User

Joined: 03 Jun 2005
Posts: 5

 Posted: Thu Jun 09, 2005 12:20 pm    Post subject: Re: What does packed decimal digits means. Hi I think it will take 3 bytes 2.5 +.5 .As far as alphanumeric picture clause is concern i am not sure whether we can define it or not Frame
j_prameela2000

New User

Joined: 01 Jun 2005
Posts: 28
Location: Chennai

 Posted: Thu Jun 09, 2005 12:31 pm    Post subject: Re: What does packed decimal digits means. It is (n+1)/2 for odd digit and (n/2 + 1) for even digit. Try this out. You will get exactly how many bytes does the variable occupies. If any alterations in my answer, correct it.
Sangram

New User

Joined: 08 Jun 2005
Posts: 7

 Posted: Thu Jun 09, 2005 12:38 pm    Post subject: Re: What does packed decimal digits means. Hi Senthilkumar, COMP 3 usage is usually done for signed integers. Thats the most common and optimum use of comp 3 . The storage space for COMP 3 is calculated by using the formula (n+1)/2 where 'n' stands for the actual size of the variable. For e.g. - a variable of PIC X(5) COMP-3 will take 3 bytes of storage where the 5 bytes of the variable will be stored in 2.5 bytes of actual storage and the sign will be stored in 0.5 bytes of actual storage. The sign is always stored in the last half byte of the actual storage. If you need further info, drop in a reply.
worthy2005

New User

Joined: 09 Mar 2005
Posts: 17
Location: Shanghai,China

Posted: Tue Jul 19, 2005 9:36 pm    Post subject: Re: What does packed decimal digits means.

 j_prameela2000 wrote: Eg. to represent +5, one byte is needed which is denoted as 5+ where 5 holds the binary value 0101 and + holds the binary bit pattern value 1100.

But how about -5? '+' represents 1100, but '-' represents what? Thanx!
thanooz

New User

Joined: 28 Jun 2005
Posts: 99

 Posted: Tue Jul 19, 2005 9:58 pm    Post subject: hi comp-3 is used store data in packed decimal format.it is hexa decimal storage.the n/2 bytes for actuval value 1/2 byte for sign representation if its sign is positive last halfbyte have hexa c,negative d,unsigned f . thanooz
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am

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