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
 

 

Read the INPUT flat file and get the formatted OUTPUT file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
mandyaharsha

New User


Joined: 16 May 2009
Posts: 12
Location: Bangalore

PostPosted: Thu Aug 23, 2012 1:05 pm    Post subject: Read the INPUT flat file and get the formatted OUTPUT file.
Reply with quote

Hi All,

I have a requirement where the business will be sending an INPUT file and I need to create a formatted OUTPUT file based on the copybook.
Generic Input file:

ABC|XY|DEF|.................. This record will be of length 4096.
AB|XYZ|DE|P|..................
A|XY|D|PQR|......

Output file should be generated in the below manner:

ABC............XY............DEF............
AB..............XYZ..........DE..............P..............
A................XY............D................PQR..........

Note: Both INPUT and OUTPUT files are mix of CHAR, NUM and DECIMAL values.

To be precise on the output file format, if the first data before '|' is of length 3 and in the COPYBOOK if its variable length is 10 then we have to add 7 spaces along with data i.e., ( ABC ……….) Same is applicable for all the remaining data and here we have to remove '|' in the output record in all the places(we should allow extra space for ‘|’ to occupy).

I am trying to implement this with REXX or JCL (using ICETOOL) but not really able to get into conclusion to start up with.

But was thinking will have to make use of INDEXING here.

Could you please throw some light on this?

Thank you.
Harsha






Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Aug 23, 2012 1:21 pm    Post subject: Reply to: Read the INPUT flat file and get the formatted OUT
Reply with quote

search the forum about converting CSV datasets to fixed format datasets
( the fact that the separator is the | still makes the records CSV records )
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 Aug 23, 2012 6:47 pm    Post subject:
Reply with quote

Hello,

If you are not already experienced in REXX, suggest you use your sort product.

As Enrico mentioned, there are examples in the forum of reformatting delimited files.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 23, 2012 7:03 pm    Post subject:
Reply with quote

Quote:
But was thinking will have to make use of INDEXING here.

meaning that you were also thinking of a COBOL solution?

Quote:
Note: Both INPUT and OUTPUT files are mix of CHAR, NUM and DECIMAL values.


NOTE BIEN: bytes are bytes.
the way that you datatype them is how they are treated
by instructions.

REXX treats everything as alphanumeric.
if you have valid characters within a variable that conform to a datatype,
instructions will treat them
according to the datatype rules associated with those instructions.

as has been said before in this thread, other threads, and conversations/writings
a 4096 record with an unknown number of records
is not a good REXX target.

Sort products do this kind of stuff very easily
and there are many examples in the forum
as well as documented as CSV conversions within the DFSORT SORTTRCKS PDF.
Back to top
View user's profile Send private message
PANIGRAHI,DEVA

New User


Joined: 20 Aug 2012
Posts: 3
Location: India

PostPosted: Mon Aug 27, 2012 6:07 pm    Post subject: Reply to: Read the INPUT flat file and get the formatted OUT
Reply with quote

Hi Harsha,

You can use this SORT Card to format your file.


Code:
OPTION COPY                                     
INREC PARSE=(%00=(ENDBEFR=C'|',FIXLEN=10),       
           %01=(ENDBEFR=C'|',FIXLEN=10),         
           %02=(ENDBEFR=C'|',FIXLEN=10),         
           %03=(ENDBEFR=C'|',FIXLEN=10)),       
           BUILD=(%00,C'.',%01,C'.',%02,C'.',%03)
OUTREC FINDREP=(IN=C' ',OUT=C'.')
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Aug 27, 2012 6:14 pm    Post subject: Reply to: Read the INPUT flat file and get the formatted OUT
Reply with quote

the dots were fillers ...
the ts lazily forgot to enclose the data within the code tags

( the code tags preserve the spacing )
Back to top
View user's profile Send private message
mandyaharsha

New User


Joined: 16 May 2009
Posts: 12
Location: Bangalore

PostPosted: Wed Aug 29, 2012 6:23 pm    Post subject:
Reply with quote

Hi Deva,

Thanks for that.But last week I followed below points

In the STEP01 modified the INPUT rec using ICEMAN

OPTION COPY
OUTREC FINDREP=(IN=C'| ',OUT=C' |')

and then treated the OUTPUT of STEP01 as INPUT to STEP02 where I used a COBOL program and did a UNSTRING of the INPUT file for all the input records with COPYBOOK as reference.

I was sucessfull in getting the desired output.

But my INPUT file as so many VARIABLES that I have to mention all the VARIABLES in the UNSTRING syntax which looks little messy. Even I'm wondering how UNSTRING works for a VARIABLE which is defined with OCCURS clause.

So I'm interested in knowing about other options for this,If any??

Thank you.
Harsha
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 Aug 29, 2012 6:30 pm    Post subject:
Reply with quote

Hello,

UNSTRING works the same for both. . .

If you post a bit of the data definition and the question about how to use it, someone should be able to clarify.

As this would be a COBOL question, you should start a new topic in the COBOL part of the forum.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Wed Aug 29, 2012 7:50 pm    Post subject:
Reply with quote

Easy-peasy PARSEing with Rexx - just a lot of R's and RR's in the editor. However I was not allowed to use Rexx (Philistines!) so used DFSORT. Look in that forum for the last topic started by me. Note: you can only parse 100 fields at a time with DFSORT so the last parse would be the remainder of the record and then repeat the process. (I think that is the way but there was a topic a few months ago that met this limitation so you could search for that as well.)
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Wed Aug 29, 2012 8:07 pm    Post subject: Reply to: Read the INPUT flat file and get the formatted OUT
Reply with quote

If you tell us which Sort product you use, we'll get it shifted to the correct place to at least stop people telling you to use Sort to do it.

Plus, I hope you don't have any "unsigned packed-decimal" or "binary" fields in your records...
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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