MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File Comparing using Sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Wed Aug 20, 2003 6:38 pm    Post subject: File Comparing using Sort Reply with quote

Hi,
I'm having two files(File-1 and File-2).I want to compare these two files and extract all the unmatched records from the File-2. For example my inputs and output are as follows.Both are having the key filed at 1,3.
File-1 doesn't have any duplicates whereas File-2 has duplicates.
Code:

File-1
------
AAA
BBB
CCC
DDD

File-2
------
AAA    1111    11111
AAA    2222    12121
BBB    2122    21212
BBB    2212    12112
EEE    1212    23232
FFF    3323    21212
FFF    4423    21212
GGG    1212    21212
GGG    2333    12121

My output should be
----------------------
EEE     1212    23232
FFF     3323    21212
FFF     4423    21212
GGG     1212    21212
GGG     2333    12121


Can anybody tell me how can I achieve this using SORT..?
Thanks,
-Somu
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Aug 20, 2003 7:45 pm    Post subject: Reply with quote

Somu,

If you have DFSORT R14 PTF UQ90053 (Feb, 2003), you can use the new SPLICE operator of DFSORT's ICETOOL to do this. For complete information on SPLICE, see:

http://www.storage.ibm.com/software/sort/mvs/uq90053/online/srtmutol.html#spl

I assumed your input data sets had RECFM=FB and LRECL=80, but the job can be adjusted for other attributes.

Here's the DfSORT/ICETOOL job:

Code:

//S1 EXEC PGM=ICETOOL                                         
//TOOLMSG DD SYSOUT=*                                         
//DFSMSG DD SYSOUT=*                                         
//FILE1 DD DSN=...  input file1                           
//FILE2 DD DSN=...  input file2                           
//F2ONLY DD DSN=...  output file       
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))   
//T2 DD DSN=&&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))   
//T3 DD DSN=&&T3,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))   
//CONCT DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)           
// DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)                 
// DD DSN=*.T3,VOL=REF=*.T3,DISP=(OLD,DELETE)                 
//TOOLIN DD *                                                 
* Add C'BB' identifier for FILE1 records.                     
COPY FROM(FILE1) TO(T1) USING(CTL1)                           
* Add C'XX' identifier for first copy of FILE2 records.       
* Add C'VV' identifier for second copy of FILE2 records.     
COPY FROM(FILE2) USING(CTL2)                       
* SPLICE to match up records and write records     
* with C'VX' identifier to F2ONLY.                 
SPLICE FROM(CONCT) TO(F2ONLY) ON(1,3,CH) -         
WITHALL WITH(1,81) USING(CTL3)                     
/*                                                 
//CTL1CNTL DD *                                     
* Mark FILE1 records with C'BB'                     
  OUTREC FIELDS=(1,80,81:C'BB')                     
/*                                                 
//CTL2CNTL DD *                                     
* Mark first copy of FILE2 records with C'XX'.     
  OUTFIL FNAMES=T2,                                 
    OUTREC=(1,80,81:C'XX')                         
* Mark second copy of FILE2 records with C'VV'.     
  OUTFIL FNAMES=T3,                                 
    OUTREC=(1,80,81:C'VV')                         
/*           
//CTL3CNTL DD *                                           
* Write FILE2 only records to F2ONLY file. Remove id.     
  OUTFIL FNAMES=F2ONLY,                                   
    INCLUDE=(81,2,CH,EQ,C'VX'),                           
    OUTREC=(1,80)                                         
/*                                                                                             

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Thu Aug 21, 2003 3:59 am    Post subject: Reply with quote

Hi Franks,
Thanks a lot for the solution. But I don't have the required PTF (DFSORT R14 PTF UQ90053 ) installed. I will try to get it done as soon as possible. But would like to know whether we can do it without using the SPLICE operator..
Please advice ..

Thanks
-Somu
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 21, 2003 10:24 am    Post subject: Reply with quote

Somu,

Given that you have duplicates in File2 that you want to keep, I don't know of any other "practical" way to do this without SPLICE.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Mon Sep 08, 2003 5:31 am    Post subject: Reply with quote

I have a utility written in Assembler to do this sort of job.
E-mail me, if you are interested in it.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Sep 08, 2003 6:13 am    Post subject: Reply with quote

somuk,

Do you have easytrieve at your shop??

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Wed Sep 10, 2003 7:06 am    Post subject: Reply with quote

Yes Kolusu.. I have solved this with easytrieve..

Thanks
-Somu
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group