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
 

 

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: 34
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: 34
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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm


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