SORT utility to eliminate the duplicate records



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Re: SORT utility to eliminate the duplicate records

Postby jaganmoni » Fri Oct 31, 2008 9:29 pm

Hi Frank,

I have two files (FILE A and FILE B). The file LRECL, RECFM and type for both files are 13, FB, CH. I want to Compare FILE A and FILE B. If the File A record is in FILE B I want to write it in FILE C. If the file FILE A record is not in FILE B I want to write it in file D.
Can you please help me on this...
The data in each file is like below:

Input Files:
FILE A:
00018-0004787
00018-0004808
00042-0000023
00042-0002140

FILE B:
00018-0004370
00018-0004565
00018-0004787
00026-0000580

Output Files:
FILE C:
00018-0004787

FILE D:
00018-0004808
00042-0000023
00042-0002140
jaganmoni
 
Posts: 6
Joined: Tue Oct 28, 2008 12:13 am
Has thanked: 0 time
Been thanked: 0 time

Re: SORT utility to eliminate the duplicate records

Postby Frank Yaeger » Fri Oct 31, 2008 10:21 pm

Here's a DFSORT/ICETOOL job that will do what you asked for:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//FILEA DD DSN=...  input fileA (FB/13)
//FILEB DD DSN=...  input fileB (FB/13)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=...  output fileC (FB/13)
//FILED DD DSN=...  output fileD (FB/13)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(FILEC) ON(1,13,CH) ALLDUPS DISCARD(FILED) -
  USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(14:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(14:C'2')
/*
/CTL3CNTL DD *
 OUTFIL FNAMES=FILEC,INCLUDE=(14,1,CH,EQ,C'1'),BUILD=(1,13)
 OUTFIL FNAMES=FILED,INCLUDE=(14,1,CH,EQ,C'1'),BUILD=(1,13)
/*
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Previous

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post