IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to UNPACK variable felds in a Copybook


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ksannigeri

New User


Joined: 08 Apr 2005
Posts: 18

PostPosted: Wed May 30, 2012 10:09 am
Reply with quote

Hello,
I have a requirement to unpack some of the fileds from my existing copybook.This is a Output file copybook.

The existing copybook has
ABC---s9(5)v99 Comp-3
XYZ--- 9(3) comp-3

I need to change the Copybook to unpack these fields.
Could you pls let me know if I can Just change the fields to
ABC---s9(5)v99
XYZ--- 9(3)

By removing the comp-3

Thanks
Back to top
View user's profile Send private message
ksannigeri

New User


Joined: 08 Apr 2005
Posts: 18

PostPosted: Wed May 30, 2012 10:56 am
Reply with quote

I have already tried it..its coming fine..but not sure..whether this is the right thing to unpack the fields..as the Copybook record length will Change after unpacking the fields.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed May 30, 2012 11:10 am
Reply with quote

Phew check with the person who had assigned you this or try answering these questions work why you are doing this xhange ? what is actually required and what is the output required and what needs to be done with increased lrecl will prorams using these files wont be impacted and so as copybooks

If you could answer these yourself you could get more clarity

Ppl here never know what is needed unless you explain for better guidance\suggestions
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed May 30, 2012 12:15 pm
Reply with quote

How else do you propose to convert from packed dec to zoned dec? What do you mean by "output" copybook. One assumes that it will be an "input" copybook in another process. Is that other process expecting zoned decimal numbers or is it a new downstream process using a similar layout but zoned dec? If the latter, and existing programs using the copybook are not changing, then you need a new copybook.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed May 30, 2012 9:37 pm
Reply with quote

Hello,

Be aware that if you change the copybook, all of the existing files will have to be converted. The original data will no longer be easily usable. . .

Also, any jcl that references this file format (i.e. lrecl/blksize) will have to be changed.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 31, 2012 2:13 pm
Reply with quote

Your question is hard to comprehend.

If this is the current definition
Code:
01 ABC   PIC S9(5)V99 COMP-3.
01 XYZ   PIC 9(3) COMP-3 .   
and you want to change it to zone-decimals instead of packed, without changing the length of the copybook, this is what you should look forward to:
Code:
01 ABC   PIC S9(2)V99.
01 XYZ   PIC 9(2).   
but only if I understood clearly what you mean!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu May 31, 2012 7:05 pm
Reply with quote

Hello,

Even if the definitions are changed to preserve the record length, all of the existing files will still have to be converted. The content would not match the revised copybook.
Back to top
View user's profile Send private message
ksannigeri

New User


Joined: 08 Apr 2005
Posts: 18

PostPosted: Fri Jun 01, 2012 12:08 pm
Reply with quote

Hello,

thanks all for your suggestion and valuable guidance.

the output file which is being created was using this Copybook and since we needed to unpack the fields in the output file.So I have unpacked the Fields from the Copybook.
ABC & XYZ are the output file fields.

In the program to create the o/p file, they were moving some

move 111 to ABC
Move 222 to XYZ.

111 & 222 were unpacked alphanumeric fields.So I have unpacked ABC & XYZ to include the PIC clause of the 111 & 222.

After unpack, the record length of the copybook, so as the output file increases.
I have changed(Increased) the LRECL of the output file to accommodate the unpacked fields.Similarly the File Record length has been changed in the program.

Now I am able to see the output in a readable format.

Thanks
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jun 01, 2012 4:46 pm
Reply with quote

Quote:
Now I am able to see the output in a readable format.
Sorry if that sounds rude - but, is this all you wanted?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 01, 2012 6:46 pm
Reply with quote

Hello,

Quote:
Now I am able to see the output in a readable format.
If the data is packed, you can still "see" it - all you need o do is use HEX ON.

If there was no other reason to unpack tha data, you have just wasted space and damaged performance . . . icon_sad.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Trying to change copybook in online c... CICS 4
No new posts Help to Filter File Manager Copybook ... DFSORT/ICETOOL 14
Search our Forums:

Back to Top