Exforsys

Free Training

Packed-decimal conversion or unpacked

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 will be the layout ...

Go Back   Exforsys > Programming Talk > COBOL

Exforsys.com

  #1 (permalink)  
Old 12-12-2006, 08:27 PM
Junior Member
 
Join Date: Dec 2006
Location: New Freedom, PA
Posts: 1
dionyemah is on a distinguished road
Packed-decimal conversion or unpacked

I need to unpack a packed-decimal field such as :

PACKED-FIELD PIC S9(8)V99 USAGE COMP-3.

What will be the layout for it to be unpacked?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-19-2007, 03:44 PM
Senior Member
 
Join Date: Apr 2006
Posts: 122
rachelle is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2007, 03:53 PM
Senior Member
 
Join Date: Apr 2006
Posts: 144
caradoc is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2007, 03:58 PM
Senior Member
 
Join Date: Apr 2006
Posts: 138
Ralph is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-26-2007, 03:34 PM
Junior Member
 
Join Date: Jul 2007
Posts: 8
eddie13 is on a distinguished road
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]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-04-2008, 10:38 AM
grlewycky's Avatar
Junior Member
 
Join Date: Jan 2007
Posts: 9
grlewycky is on a distinguished road
if you have DFSORT latest version you dont need a cobol program

I have a document at Index of /oracle/files
__________________
from the mind of George Lewycky
grlewycky@yahoo.com | http://georgenet.net/oracle
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Conversion Of Om Holds ! kittu Oracle Apps 0 02-11-2006 12:19 AM


All times are GMT -4. The time now is 07:54 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.