Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Filtering records in a file based on another file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Filtering records in a file based on another file.
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 Moderator


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

PostPosted: Sat May 22, 2010 1:06 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us