Split the input file using delimiter and output only few col

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
balaryan
Member
Posts: 7
Joined: Thu Aug 14, 2014 9:41 am
Location: Chennai

Split the input file using delimiter and output only few col

Post by balaryan » Tue Oct 18, 2016 3:37 am

Hi All,

I am trying to read an input file which has a fixed length of 300 bytes and each field in a record are delimited by "|" pipe symbol. For instance

[u]Input file:[/u]

1|232|this is great|chennai|TN|604023|04/12/2018|12321.00|12312.00|N|this is for testing only|external remarks|0|0|3|Y|N|454.00|454.00
1|1232|this is great-o-great|Pune|MA|604023|04/11/2015|321.00|122.01|Y|this is for testing only|external remarks with comments|0|0|4|Y|N|54.00|14.00
1|8059|this is amazing|banglore|KA|298923|28/04/2013|321.00|662.00|N|this is for testing|external remarks|0|0|5|Y|N|344.00|984.00
1|092334|this is outstanding data|Mumbai|MA|23908043|18/08/2016|23321.00|656262.23|Y|this is for purely for testing only|external remarks|0|0|5|N|Y|323.00|1284.00
1|332|this is super|Pune|MA|6023|06/11/2010|9032.12|1233.01|Y|this is for testing only|comments|0|0|5|Y|N|154.00|124.00


I want to include only specific FIXED columns of each record from the input file say 1st, 2nd, 4th, 5th, 6th,9th, 10th, 13th, 14th, 15th in the output file. Is there any option or way to select the records based on the column using the delimiter without fixed length record?

Kindly advice.
B@L@

balaryan
Member
Posts: 7
Joined: Thu Aug 14, 2014 9:41 am
Location: Chennai

Post by balaryan » Tue Oct 18, 2016 3:47 am

Also I missed one info. Last field in each record will be having either 'Y' or 'N'. Based on the value, if it is 'Y', we should place the record with specific column in output file 1 and if it is 'N' means output file 2.
B@L@

magesh_j
Member
Posts: 16
Joined: Wed Aug 31, 2016 8:32 am

Post by magesh_j » Fri Oct 21, 2016 12:12 am

Yes, Possible using INREC PARSE.

Should your output be without a delimiter or with the delimiter?

If without the delimiter, you want the output of each column to be fixed or variable?

magesh_j
Member
Posts: 16
Joined: Wed Aug 31, 2016 8:32 am

Post by magesh_j » Fri Oct 21, 2016 12:13 am

what is the possibility of showing expected output ?

balaryan
Member
Posts: 7
Joined: Thu Aug 14, 2014 9:41 am
Location: Chennai

Post by balaryan » Mon Mar 13, 2017 8:07 pm

@Mahesh. Yes. I achieved the desired results with INREC PARSE, BUILD and OUTREC OVERLAY. Thanks.
B@L@

balaryan
Member
Posts: 7
Joined: Thu Aug 14, 2014 9:41 am
Location: Chennai

Post by balaryan » Mon Mar 13, 2017 8:09 pm

@Mahesh. Yes. I achieved the desired results with INREC PARSE, BUILD and OUTREC OVERLAY. Thanks.
B@L@

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others