IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to compare two CSV files using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top