Simple Match of 2 Files on Key field

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Simple Match of 2 Files on Key field

Post by Veera » Thu Nov 13, 2008 2:19 am

Rajini has posted one question in COBOL forum, this can be used if
Rajini can use ICETOOL utility rather than COBOL.

Code: Select all


//JS010    EXEC PGM=ICETOOL                   
//TOOLMSG   DD SYSOUT=*                       
//DFSMSG    DD SYSOUT=*                       
//*                                           
//IN     DD *    input file1                             
11111                                         
22222                 
//        DD *    input file2             
33333            
11111                                      
/*                                           
//OUT1   DD SYSOUT=*                          
//TOOLIN DD *                                 
  SELECT FROM(IN) TO(OUT1) ON(1,5,ZD) FIRSTDUP
/*

Output will be -> Record 11111 will be written into the O/P file.

Assume 11111 as A/C no...then matched records are being written into the O/P files.

ON(1,5,ZD) -> This declaration has to be changed accordingly based on the account num length
and datatype.

IN and OUT1 DD's can be substituted as below to deal with files.

Code: Select all

//IN       DD DSN=FILE1,DISP=SHR
//          DD DSN=FILE2,DISP=SHR 
//OUT1     DD DSN=OUTFILENAME,      
//          DISP=(,CATLG,DELETE),             
//          UNIT=SYSDA,                       
//          SPACE=(CYL,(1,2),RLSE)          


NOTE: Few things which we need to be careful about
a) Whether there will be any dups in file1 or file1
b) If dups,do we want to capture all dups or only first dup.

Based on your requirement the job can be changed accordingly.

Thanks,
Veera

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Nov 13, 2008 3:47 am

For a more exhaustive discussion of handling various matching and joining situations with DFSORT's ICETOOL (SELECT and SPLICE), see the following Smart DFSORT Tricks:

o Create files with matching and non-matching records
o Join fields from two files on a key
o Join records on a key with missing fields
o Join fields from two files record-by-record

at:

www.ibm.com/systems/support/storage/sof ... vs/tricks/
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

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