This is a discussion on Packed-decimal conversion or unpacked within the COBOL forums, part of the Programming Talk category; I need to unpack a packed-decimal field such as : PACKED-FIELD PIC S9(8)V99 USAGE COMP-3. What ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
COBOL Comp-3 is a binary field type that puts ("packs") two digits into each byte, using a notation called Binary Coded Decimal, or BCD. This halves the storage requirements compared to a character, or COBOL "display", field.
|
|
|||
|
Comp-3 fields are denoted in COBOL with the "usage is" clause after the PIC, like this:
PIC S9(5) usage is computational-3. In the above the clause usage is optional and can be omitted and used also as PIC S9(5) comp-3. The COBOL PIC, or picture, for a comp-3 packed field specifies the number of digits after unpacking. Hope the above explanation would help you. |
|
|||
|
It was a good explanation on Packed-decimal representation in COBOL. But I am curious to know how this Comp-3 packed fields are stored internally in COBOL and how many bytes are stored for these Comp-3 packed fields. Could you give idea on these concepts.
|
|
|||
|
Ralp and dionyemah,
COBOL compilers do the conversions for you. Just define the packed field and the unpacked field, and move one to the other. PIC S9(8)V99 COMP-3 would be moved to a PIC S9(8)V99. The actual storage of the comp-3 would be 6 bytes. comp-3 storage is more effecient for odd length fields. .. s9(9)v99 also uses 6 bytes. if you could see each byte for number 1234-, it would be [00][00][00][01][23][4B] a positive 1234 would be [00][00][00][01][23][4C] 12345 ... [00][00][00][12][34][5C] |
|
||||
|
if you have DFSORT latest version you dont need a cobol program
I have a document at Index of /oracle/files |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Conversion Of Om Holds ! | kittu | Oracle Apps | 0 | 02-11-2006 12:19 AM |