Find records in both files with SORT



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Find records in both files with SORT

Postby Puffe » Mon May 02, 2011 10:38 pm

Hi there,

I have two files and both are fixed blocked and lrecl=10.

File A (key position 1-5) consists of
KevinDukes
KevinWeaks
MikeyHanks
RickiManta
SteveBould
SteveDavid

File B (key position 6-10) consists of
11111Steve
22222Steve
22222Nelli
33333Ricki
44444Vicki
55555Vicki

What I want to accomplish is to find all records with the same key and they must be in both files.

So the result should be the following records
RickiManta
SteveBould
SteveDavid
11111Steve
22222Steve
33333Ricki

Thanks in advance.

Regards,
Mikael
Puffe
 
Posts: 21
Joined: Mon May 02, 2011 1:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Find records in both files with SORT

 

Re: Find records in both files with SORT

Postby skolusu » Mon May 02, 2011 11:59 pm

puffe,

Use the following DFSORT/ICETOOL JCL which will give you the desired results.

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//INA      DD *                                             
KEVINDUKES                                                 
KEVINWEAKS                                                 
MIKEYHANKS                                                 
RICKIMANTA                                                 
STEVEBOULD                                                 
STEVEDAVID                                                 
//INB      DD *                                             
11111STEVE                                                 
22222STEVE                                                 
22222NELLI                                                 
33333RICKI                                                 
44444VICKI                                                 
55555VICKI                                                 
//T1       DD DSN=&&OUT,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                             
  COPY JKFROM TO(T1) USING(CTL1)                           
  SORT FROM(T1) USING(CTL2)                                 
//CTL1CNTL DD *                                             
  JOINKEYS F1=INA,FIELDS=(1,5,A)                           
  JOINKEYS F2=INB,FIELDS=(6,5,A)                           
  REFORMAT FIELDS=(F1:1,10,F2:1,10)                         
  OUTFIL BUILD=(1,10,1,5,/,11,10,16,5)                     
//*                                                         
//CTL2CNTL DD *                                             
  SORT FIELDS=(11,5,CH,A,1,5,CH,A),EQUALS                   
  OUTREC OVERLAY=(11:SEQNUM,3,ZD,RESTART=(1,10))           
  OUTFIL FNAMES=OUT,OMIT=(11,3,ZD,GT,1),BUILD=(1,10)       
/*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Find records in both files with SORT

Postby Puffe » Tue May 03, 2011 1:12 am

Thanks, but I'm pretty sure our company don't have the right version of ICETOOL where I can use JOINKEYS. Any other suggestion?
Puffe
 
Posts: 21
Joined: Mon May 02, 2011 1:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Find records in both files with SORT

Postby skolusu » Tue May 03, 2011 1:25 am

Puffe,

Run the following job and show us the complete sysout which will help us determine the level of DFSORT you have

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *           
A                         
//SORTOUT  DD SYSOUT=*     
//SYSIN    DD *           
  SORT FIELDS=COPY         
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post