Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to compare two CSV files using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
purushottam

New User


Joined: 26 Feb 2007
Posts: 37
Location: pune

PostPosted: Mon Apr 04, 2011 9:55 pm    Post subject: How to compare two CSV files using SORT
Reply with quote

Please help me with the below task

I need to compare two PS files and get the matching records in output but one of the Input is CSV file. Input records looks something like below

Input1:

000999ABC
263748XYZ

It's a FB file with LREC of 9 and key position is 1 to 6
Input2:

999;ABC;NAME......
263748;XYZ;NAME.....

It's a FB file with LREC of 80. Key position is 1 to 6, But as for the first record it contains only 999 but not the laeding 0's and not even trailing spaces.

Output I need is

000999
263748

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

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Apr 04, 2011 10:06 pm    Post subject:
Reply with quote

purushottam,

The following DFSORT JCL will give you the desired results.


Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//INA      DD DSN=Your 9 byte input fb file,DISP=SHR
//INB      DD DSN=your 80 byte csv file,DISP=SHR
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                 
  OPTION COPY                                   
  JOINKEYS F1=INA,FIELDS=(1,6,A)                 
  JOINKEYS F2=INB,FIELDS=(1,6,A)                 
  REFORMAT FIELDS=(F1:1,9)                       
//JNF2CNTL DD *                                 
  INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=6)),     
        BUILD=(%00,UFF,M11,LENGTH=6)             
//*
Back to top
View user's profile Send private message
purushottam

New User


Joined: 26 Feb 2007
Posts: 37
Location: pune

PostPosted: Tue Apr 05, 2011 12:18 pm    Post subject: Reply to: How to compare two CSV files using SORT
Reply with quote

Skolusu, Thank you very much for the code It worked as needed. icon_smile.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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 7 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods DFSORT/ICETOOL 2 Fri Sep 22, 2017 6:00 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 4 Fri Sep 22, 2017 4:56 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us