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
 

 

Unpack COMP/COMP-3 fields

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

New User


Joined: 03 Jul 2014
Posts: 5
Location: india

PostPosted: Thu Jul 03, 2014 11:56 am    Post subject: Unpack COMP/COMP-3 fields
Reply with quote

Hi,

We need to migrate files to WINDOWS, for this purpose, the packed decimal fields needs to be Unpacked.

I am looking to code a generic COBOL program which can be used to unpack COMP/COMP-3 fields to corresponding length Non-Comp field. I will be having 2 input files. First file will be the one to be unpacked. Second file will contain info about the layout of the file in below format

Code:
START POS(1-4)  END-POS(5-8)   DATATYPE(9-10)
        1             3              PD


Above is example for S9(5) COMP-3, occupying 3 bytes which needs to be moved to PIC S9(5) occupying 6 bytes in DISPLAY format.

I can make the input file as VARYING with maximum length possible and also, the output file as VARYING in order to accomodate the increased LRECL.

Is this workable? If so, Can you please give me an idea on how to code this?

I hope i made it clear, if not please let me know.

Thanks in advance!

Code'd and de-mangled
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu Jul 03, 2014 12:56 pm    Post subject: Reply to: Unpack COMP/COMP-3 fields
Reply with quote

You'll need to know if the field is signed, or not (unless all are unsigned, or all are signed).

Given the information you are supplying, I'd do it in SORT, rather than a COBOL program. Process your second file to generate SORT control cards, run the generated cards on file 1.
Back to top
View user's profile Send private message
vinodh k r

New User


Joined: 03 Jul 2014
Posts: 5
Location: india

PostPosted: Thu Jul 03, 2014 1:05 pm    Post subject:
Reply with quote

Hi Bill,

Thanks for your post!

The second file, that is the layout file will be a manual file so we can add info expected by you like whether field is SIGNED or UNSIGNED. In the file to be migrated, it can contain mixed types.

I do agree that this could be done in SORT with OUTREC fields, EDIT mentioning SIGN, but as conveyed earlier i am looking to make something GENERIC so that once we manually make the layout file with information

START POS END POS DATATYPE SIGNED/UNSIGNED
1 3 PD S

I am expecting it to get unpacked to corresponding DISPLAY format.

Since we have 250 files, and for all file, SORT card cannot be coded manually so thinking to make this generic.

Do you think if not in COBOL, by REXX could we make this work?

Thanks in advance!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu Jul 03, 2014 1:44 pm    Post subject: Reply to: Unpack COMP/COMP-3 fields
Reply with quote

What I'm suggesting is that you take your file description, and generate the SORT control cards from that.

Why is file 2 manual? Have you looked at extracting it from a compile listing?

PS. I never use OUTREC FIELDS. If I need to use OUTREC to make a new record, I use BUILD. Join us in the 21st Century, please.
Back to top
View user's profile Send private message
vinodh k r

New User


Joined: 03 Jul 2014
Posts: 5
Location: india

PostPosted: Thu Jul 03, 2014 2:29 pm    Post subject:
Reply with quote

Hi Bill,

The files that i need to migrate are from different systems, we do not have the program compile listing that generates these files.

We are provided only with files and the Layout of it in copybook format.

I am just curious to know if through the available input, can we make some generic code/tool which can be used for all files to be able to migrate either through SORT or COBOL program.

PS: Thanks for pointing about BUILD! Will use that henceforth icon_smile.gif

Thanks in advance!
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Jul 03, 2014 6:41 pm    Post subject:
Reply with quote

If I had to do this, I would do it in COBOL, and maybe I would use the whole copybook as parameter ("2nd file").
But I would have a few questions, like:
In which format the file is expected, on the PC side: plain flat file, CSV, XML ?
Are there also COMP values ?
What about dates ?
Back to top
View user's profile Send private message
vinodh k r

New User


Joined: 03 Jul 2014
Posts: 5
Location: india

PostPosted: Mon Jul 07, 2014 10:17 am    Post subject:
Reply with quote

Hi Marso,

The file is expected in PC side is plain flat file.
Yes there are COMP values in files at different places.
There will be no date fields in the file.

If you have an idea to do it in COBOL, can you please explain the process?

Thanks in advance!
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 Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm


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