Need to compare two files using sort in jcl

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
manjeera.bonakurthi
Member
Posts: 1
Joined: Thu Feb 18, 2010 6:53 pm

Need to compare two files using sort in jcl

Post by manjeera.bonakurthi » Thu Feb 18, 2010 7:06 pm

Hi I need to compare two files using SORT utility like...
File 1
id some- acc.no time date some fields..
1 sdbskafjo 456 12 12302009 nejfirejt
2 narjweop 678 dfngijreo

File2

3 nwerjieo 456 12 12302009 eitjertrro
4 sfeijwerf 678 34 10202009 nkewrewe

Now I want the o/p as..
1 3

Here we have to consider composite key like..acc.no+time+date
If these 3 fields are same in two files then I need the acc.no of those two perticular records from two files in third file...
Need Immediate respone pls.....need to finish by 2mr

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Re: Need to compare two files using sort in jcl

Post by skolusu » Sat Feb 20, 2010 12:19 am

manjeera.bonakurthi wrote:Need Immediate respone pls.....need to finish by 2mr
If you need an immediate response , you need to do a better job of providing more details

1. what is the LRECL and RECFM of file1
2. what is the LRECL and RECFM of file2
3. What is the position and format of the composite key in file1
4. What is the position and format of the composite key in file2
5. Does file-1 has duplicates based on the composite key?
6. Does file-2 has duplicates based on the composite key?
7. What is the LRECL and RECFM of output file?
8. Post ALL the rules need for matching
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

Alissa Margulies
Member
Posts: 25
Joined: Tue Apr 28, 2009 10:53 pm
Location: USA
Contact:

Post by Alissa Margulies » Tue Feb 23, 2010 8:43 pm

Based on the information provided, here is a SyncSort for z/OS job that will do what you asked:

Code: Select all

//STEP1  EXEC PGM=SORT                      
//SORTJNF1 DD *                                   
1 SDBSKAFJO 456 12 12302009 NEJFIREJT             
2 NARJWEOP  678             DFNGIJREO             
//SORTJNF2 DD *                                   
3 NWERJIEO  456 12 12302009 EITJERTRRO            
4 SFEIJWERF 678 34 10202009 NKEWREWE              
//SORTOUT  DD SYSOUT=*                            
//SYSOUT   DD SYSOUT=*                            
//SYSIN    DD *                                   
  JOINKEYS FILE=F1,FIELDS=(13,3,A,17,2,A,20,8,A)  
  JOINKEYS FILE=F2,FIELDS=(13,3,A,17,2,A,20,8,A)  
  REFORMAT FIELDS=(F1:1,2,F2:1,2)                 
  SORT FIELDS=COPY     
/*                           
Alissa Margulies
SyncSort Mainframe Product Services
zos_tech@syncsort.com
201-930-8260

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