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

Filtering records in a file based on another file.


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

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Fri May 21, 2010 11:54 pm
Reply with quote

I am trying to achieve the following functionality using ICETOOL. I have two input files.

File 1 :
RECL = 10, RECFM = FB

File 2 :
RECL = 5, RECFM =FB

I wanna filter all the records from File 1 which has the characters (6,2) as '01' and the characters (1,5) of file 1 do not match with all the records in file2.

I am trying to SPLICE option but not able to arrive at the desired results. Can anybody help me with this.

An example input/output is given below for reference

File 1:
1234523422
3243223411
5435201211
3252642643
2643601642
6457601452
2345432624

File 2:
22545
32654
15213
12345
54352

Output File:
2643601642
6457601452
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat May 22, 2010 1:06 am
Reply with quote

Assuming that you don't have duplicate 1-5 values in file1, and you don't have duplicate 1-5 values in file2, you can use a DFSORT/ICETOOL SELECT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/10)
//IN2 DD DSN=... input file2 (FB/5)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/10)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,5,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INCLUDE COND=(6,2,CH,EQ,C'01')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(10:X)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(10,1,CH,EQ,C' ')
/*


Alternatively, if you have the Nov, 2009 DFSORT PTF, you can use this DFSORT JOINKEYS job:

Code:

//S2    EXEC  PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/10)
//IN2 DD DSN=... input file2 (FB/5)
//SORTOUT DD DSN=...  output file (FB/10)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,5,A)
  JOINKEYS F2=IN2,FIELDS=(1,5,A)
  JOIN UNPAIRED,F1,ONLY
  OPTION COPY
/*
//JNF1CNTL DD *
  INCLUDE COND=(6,2,CH,EQ,C'01')
/*
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Sat May 22, 2010 1:39 am
Reply with quote

Bull's eye Frank. Thanks a lot. I really appreciate your efforts in helping us.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top