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
 

 

How to UNPACK variable felds in a Copybook

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to UNPACK variable felds in a Copybook
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    Post subject:
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

Moderator


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

PostPosted: Wed May 30, 2012 11:10 am    Post subject:
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: 1712
Location: UK

PostPosted: Wed May 30, 2012 12:15 pm    Post subject:
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

Site Director


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

PostPosted: Wed May 30, 2012 9:37 pm    Post subject:
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

Senior Member


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

PostPosted: Thu May 31, 2012 2:13 pm    Post subject:
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

Site Director


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

PostPosted: Thu May 31, 2012 7:05 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri Jun 01, 2012 4:46 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jun 01, 2012 6:46 pm    Post subject:
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    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 Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am


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