sort 2 files and cut the same sentences



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

sort 2 files and cut the same sentences

Postby Kurfuerst63 » Mon Feb 13, 2012 9:04 pm

sorry for my english, im not best talking.

i have a problem. i have 2 files.one file is lager the other file is smaler with some
sentences i have collect during the day.

i want now compare both files and get out only the sentences which are not
in both files.

when i use sum fields = none i get one sentences of both but i want none of this
sentenses as output in new file, i have collect in file 2 f

hope i have explain well
best wishes
Kurfuerst63
 
Posts: 3
Joined: Mon Feb 13, 2012 8:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sort 2 files and cut the same sentences

Postby skolusu » Mon Feb 13, 2012 9:35 pm

Kurfuerst63,

By sentences , do you mean records in the file? if so you can use DFSORT's joinkeys feature to compare the 2 files and get the unmatched records like shown below . I assumed your input files to be RECFM=FB and LRECL=80
//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//INA      DD *                                   
AAA   I AM PRESENT IN BOTH SO DROP ME             
BBB   NOT IN FILE 2 , SO NEED TO PICK ME FROM F1 
CCC   I AM PRESENT IN BOTH SO DROP ME             
DDD   I AM PRESENT IN BOTH SO DROP ME             
EEE   NOT IN FILE 2 , SO NEED TO PICK ME FROM F1 
//INB      DD *                                   
AAA   MATCH RECORD                               
CCC   MATCH RECORD                               
DDD   MATCH RECORD                               
FFF   NOT IN FILE 1 , SO NEED TO PICK ME FROM F2 
GGG   NOT IN FILE 1 , SO NEED TO PICK ME FROM F2 
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  OPTION COPY                                     
  JOINKEYS F1=INA,FIELDS=(1,3,A)                 
  JOINKEYS F2=INB,FIELDS=(1,3,A)                 
  JOIN UNPAIRED                                   
  REFORMAT FIELDS=(F1:1,80,?,F2:1,80)             
  OUTFIL OMIT=(81,1,CH,EQ,C'B'),IFOUTLEN=80,     
  IFTHEN=(WHEN=(81,1,CH,EQ,C'2'),BUILD=(82,80))   
//*


The output of this is
BBB   NOT IN FILE 2 , SO NEED TO PICK ME FROM F1
EEE   NOT IN FILE 2 , SO NEED TO PICK ME FROM F1
FFF   NOT IN FILE 1 , SO NEED TO PICK ME FROM F2
GGG   NOT IN FILE 1 , SO NEED TO PICK ME FROM F2


Check this link for detailed explanation of joinkeys with examples

http://publibz.boulder.ibm.com/cgi-bin/ ... F=ICE1SH60
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: sort 2 files and cut the same sentences

Postby Kurfuerst63 » Tue Feb 14, 2012 3:11 pm

Thank you for answer me. But i dont get it fixed.

I have a file with 20 records and one with 10 records.
in file a there are the same 10 records that in file b.

so the sort should take the 10 records from file a.

i have try the sort you have write here and take INA as a file
STEP015 EXEC SORT
SYSOUT DD SYSOUT=*
INA DD DSN=TFKD.TEMP.FKSCDAT.ST0070A,DSP=SHR
INB DD DSN=TFKD.TEMP.FKSCDAT.ST0070B,DSP=SHR
Sortout DD DSN=TFKD.TEMP.OUT,DISP=(,CATLG,DELETE),
UNIT=SYSDA,SPACE=(CYL,(50,50),RLSE)
SYSIN DD *


The input Files are VB and 200 lcecl
the sentence i want compare are 107.

thanks
Kurfuerst63
 
Posts: 3
Joined: Mon Feb 13, 2012 8:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sort 2 files and cut the same sentences

Postby Kurfuerst63 » Tue Feb 14, 2012 3:51 pm

sorry was lock wrong.. input files are FB and 160 lcecl
and i want to compare full record (160)
Kurfuerst63
 
Posts: 3
Joined: Mon Feb 13, 2012 8:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: sort 2 files and cut the same sentences

Postby skolusu » Tue Feb 14, 2012 10:43 pm

use the following DFSORT JCL

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//INA      DD DD DSN=TFKD.TEMP.FKSCDAT.ST0070A,DSP=SHR
//INB      DD DSN=TFKD.TEMP.FKSCDAT.ST0070B,DSP=SHR
//SORTOUT  DD DSN=TFKD.TEMP.OUT,
//            DISP=(,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(50,50),RLSE)
//*
//SYSIN    DD *                     
  OPTION COPY                       
  JOINKEYS F1=INA,FIELDS=(1,160,A)   
  JOINKEYS F2=INB,FIELDS=(1,160,A)   
  JOIN UNPAIRED,F1,ONLY             
//*
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