Page 1 of 1

Unmatching records using icetool

PostPosted: Tue Oct 09, 2012 2:07 pm
by thermalchu
I have two files. One file contain 10 records and second file contain 20 records. Both have a 6 digit key at the same position(1-6 in both files). I wanted to compare whole records whose keys are matching and print unmatching records from both in the output file.

Input 1:
100001 mainframe
100002 cics
100004 rexx

Input 2:
100001 main
100002 cics
100003 jcl
100004 rexx pgm
100005 db2

output:
100001 mainframe
100001 main
100004 rexx
100004 rexx pgm

Re: Unmatching records using icetool

PostPosted: Tue Oct 09, 2012 2:32 pm
by thermalchu
By using NODUPS in icetool i'm getting all the mismatching records,but i need to compare only those which have same key value...

Re: Unmatching records using icetool

PostPosted: Tue Oct 09, 2012 8:01 pm
by dick scherrer
Hello,

You need to post your JCL, Sort Control statements, and the informational output generated by the run (including the message ids).

Re: Unmatching records using icetool

PostPosted: Tue Oct 09, 2012 9:26 pm
by skolusu
thermalchu,

You need to use JOINKEYS instead of select with NODUPS. Use the following DFSORT JCL which will give you the desired results

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//INA      DD *                                             
----+----1----+----2----+----3----+----4----+----5----+----6
100001 MAINFRAME                                           
100002 CICS                                                 
100004 REXX                                                 
//INB      DD *                                             
100001 MAIN                                                 
100002 CICS                                                 
100003 JCL                                                 
100004 REXX PGM                                             
100005 DB2                                                 
//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,80,F2:1,80,?)                       
                                                           
  OUTFIL IFOUTLEN=80,OMIT=(1,80,CH,EQ,81,80,CH),           
  IFTHEN=(WHEN=(161,1,CH,EQ,C'B',AND,(7,74,CH,NE,87,74,CH)),
  BUILD=(1,80,/,81,80)),                                   
  IFTHEN=(WHEN=(161,1,CH,EQ,C'2'),BUILD=(81,80))           
//*

Re: Unmatching records using icetool

PostPosted: Wed Oct 10, 2012 9:09 am
by thermalchu
Thnak you so much skolusu..Will u please tell me what 7,74,161,2 stands for?

Re: Unmatching records using icetool

PostPosted: Wed Oct 10, 2012 4:51 pm
by BillyBoyo
The example shown assumes 80-byte fixed-length records.

Position 161 of the REFORMAT record contains DFSORT's "match marker" from JOINKEYS. Values are: B - Both files (a match); 1, file 1 only (no match); 2, file 2 only (no match).

In the first IFTHEN, the matched-key records have the remainder of their data compared and two records are output in the case of a further match. In the second IFTHEN, if on file 2 only, the original file 2 record is output.

Re: Unmatching records using icetool

PostPosted: Wed Oct 10, 2012 9:07 pm
by skolusu
thermalchu wrote:Thnak you so much skolusu..Will u please tell me what 7,74,161,2 stands for?


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080