IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Filtering data from file2 that only exist in file1


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hallecodec

New User


Joined: 05 Sep 2006
Posts: 30
Location: Philippines

PostPosted: Thu Jun 12, 2008 4:43 pm
Reply with quote

hi guys,

i have a master_file(IN1) and a transaction_file(IN2). my requirement for these files is to get the records from the transaction_file that does not exists from the master_file. with that i've used the following code:

Code:

//STEP15   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD *
RECORDONE1FROMMASTERFILE
RECORDTWO2FROMMASTERFILE
RECORD3333FROMMASTERFILE
//IN2      DD *
RECORDTWO2FROMTRANSACTIONFILE
RECORD3333FROMTRANSACTIONFILE
RECORDFIVEFROMTRANSACTIONFILE
RECORDFIVEFROMTRANSACTIONFILE
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(1,1)),DISP=(MOD,PASS)
//OUT1     DD DSN=XALN.XISDD10.JCLBK.DETHOLID,
//            DISP=(NEW,CATLG,DELETE),AVGREC=K,
//            SPACE=(CYL,(1,1),RLSE),RECFM=FB,LRECL=99
//TOOLIN   DD *
  COPY FROM(IN1) TO(T1) USING(CTL1)
  COPY FROM(IN2) TO(T1) USING(CTL2)
  SELECT FROM(T1) TO(OUT1) ON(1,10,CH) ALLDUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(100:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(100:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(100,1,CH,EQ,C'2'),
    BUILD=(1,99)
/*


however, the above code would also get the records with duplicates from the transaction_file (IN2), like RECORDFIVE, which is not correct since this record does not exists from the master_file.

what can you suggest to filter out only those records from the transaction_file that only exists from the master_file. please advise. thank you very much.
Back to top
View user's profile Send private message
hallecodec

New User


Joined: 05 Sep 2006
Posts: 30
Location: Philippines

PostPosted: Thu Jun 12, 2008 5:06 pm
Reply with quote

apologies, but my desired output for this requirement should be:
Code:

RECORDTWO2FROMTRANSACTIONFILE
RECORD3333FROMTRANSACTIONFILE


however, the code i've posted displays the following output:
Code:

RECORDTWO2FROMTRANSACTIONFILE
RECORD3333FROMTRANSACTIONFILE
RECORDFIVEFROMTRANSACTIONFILE
RECORDFIVEFROMTRANSACTIONFILE


please advise on what code should i use to come up with my desired output. thanks.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 13, 2008 1:41 am
Reply with quote

hallecodec,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1      DD *                                             
RECORDONE1FROMMASTERFILE                                     
RECORDTWO2FROMMASTERFILE                                     
RECORD3333FROMMASTERFILE                                     
//IN2      DD *                                             
RECORDTWO2FROMTRANSACTIONFILE                               
RECORD3333FROMTRANSACTIONFILE                               
RECORDFIVEFROMTRANSACTIONFILE                               
RECORDFIVEFROMTRANSACTIONFILE                               
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  COPY FROM(IN1) USING(CTL1)                                 
  COPY FROM(IN2) USING(CTL2)                                 
  SPLICE FROM(T1) TO(OUT) ON(01,10,CH) KEEPNODUPS KEEPBASE -
  WITHALL WITH(01,100) USING(CTL3)                           
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=T1,BUILD=(1,10,101:1,10)                     
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=T1,OVERLAY=(101:10X)                         
//CTL3CNTL DD *                                             
  OUTFIL FNAMES=OUT,BUILD=(1,100),                           
  INCLUDE=(1,10,CH,EQ,101,10,CH,AND,11,90,CH,NE,C' ')       
/*


Hope this helps...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top