Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Convert unpacked data to packed format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kavikesav

New User


Joined: 22 Mar 2007
Posts: 21
Location: chennai

PostPosted: Mon Aug 20, 2007 9:56 am    Post subject: Convert unpacked data to packed format
Reply with quote

i am having a file which is having unpacked numbers and i want to write a cobol program to convert it to packed format so that i can use it in the another program
Back to top
View user's profile Send private message

agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Mon Aug 20, 2007 12:14 pm    Post subject:
Reply with quote

Your program will be of only one line then-
COBOL does it by MOVE!!
Code:

01 DISP-VAR 9(09).
01 COMP-3-VAR 9(09) COMP-3.

PROC DIV.
MOVE DISP-VAR TO COMP-3-VAR
Back to top
View user's profile Send private message
kavikesav

New User


Joined: 22 Mar 2007
Posts: 21
Location: chennai

PostPosted: Mon Aug 20, 2007 6:18 pm    Post subject: Reply to: Convert unpacked data to packed format
Reply with quote

S9(009)V9(2) COMP-3 when this is unpacked can u say me how many digits it will return
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Aug 20, 2007 6:32 pm    Post subject:
Reply with quote

for comp-3 fields, each digit takes half a byte and a sign half a byte,whether sign is declared or not.

N is the total number of digits.
formula:
N/2 + 1=5.5+1=5+1=6
Quote:
S9(009)V9(2) COMP-3 when this is unpacked can u say me how many digits it will return
Rounded down N/2.i.e., if N=11,11/2=5.5=5
Back to top
View user's profile Send private message
kavikesav

New User


Joined: 22 Mar 2007
Posts: 21
Location: chennai

PostPosted: Mon Aug 20, 2007 6:59 pm    Post subject:
Reply with quote

can u give me a comp-3 example and the data how it will be after it is unpacked?..i cannot catch you...
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Aug 20, 2007 7:40 pm    Post subject:
Reply with quote

Please type 'comp3' in forum search which is in right side of top of page and click GO command button.
You will find a lot of topics discussed about comp-3 variables.
Hope this will help you.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Aug 20, 2007 7:58 pm    Post subject:
Reply with quote

Hello,

No calculation is needed to move from comp-3 (packed) to zoned decimal. The number of digits specified in the comp-3 field definition will be moved into a zoned decimal field as long as the number of digits in the receiving field is big enough.

For example (from above) a field of S9(009)V9(2) COMP-3 will "move" 11 digits - the zoned decimal receiving field should be S9(009)V9(2). The difference in the fields will be that one is in character format (easily readable by the eyes) and the other is "packed" which is not easily readable by the eyes until it is shown/viewed in hex.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us