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

Selecting records from FILE 1 that meet FILE2 criteria


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

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Mon Sep 21, 2009 6:39 pm
Reply with quote

I have the following data:

Code:
Feed      Date      Other data
_____      ____      _________

ABC      2009-01-01   Test Data Line 1
ABC      2009-02-01   Test Data Line 2      
ABC      2009-03-01   Test Data Line 3   
JKL      2009-01-01   Test Data Line 4   
MNO      2009-02-02   Test Data Line 5      
MNO      2009-03-03   Test Data Line 6


I have a paramter file with the following 2 records:

Code:
Mask Low Feed_ID   Mask High Feed_ID   Date From   Date To
ABC                   ABC             2009-01-01     2009-01-01
ABC                   MNO             2009-03-01     2009-02-02


I need to select records from the first file that meet the criteria in the second file. Where Feed is between the low/High mask(incl) in the 2nd file and the dates are within low/high mask.

I would expect the following:

Code:
ABC      2009-01-01   Test Data Line 1
ABC      2009-03-01   Test Data Line 3   
JKL      2009-01-01   Test Data Line 4   
MNO      2009-02-02   Test Data Line 5   


File 1 and File 2 would just be a continuous string of data. The spaces are just guides for the headings.

Can anyone help?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Sep 21, 2009 11:34 pm
Reply with quote

Michaelod,

Your rules are not consistent.

ex: Record # 2 ABC 2009-02-01 Test Data Line 2

It is eliminated on the basis that this does not Feed is between the low/High mask(incl) in the 2nd file and the dates are within low/high mask

ex: record # 4 JKL 2009-01-01 Test Data Line 4

I am not sure as to how you picked this record? Even though the feed falls between high and low feed , the date doesn't is not within that range.


If JKL is not supposed to pick the following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN1      DD *                                                       
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
ABC                   ABC             2009-01-01     2009-01-01       
ABC                   MNO             2009-03-01     2009-02-02       
//IN2      DD *                                                       
ABC      2009-01-01   TEST DATA LINE 1                               
ABC      2009-02-01   TEST DATA LINE 2                               
ABC      2009-03-01   TEST DATA LINE 3                               
JKL      2009-01-01   TEST DATA LINE 4                               
MNO      2009-02-02   TEST DATA LINE 5                               
MNO      2009-03-03   TEST DATA LINE 6                               
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//T2       DD DSN=&&T2,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)         
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
  COPY FROM(IN1) USING(CTL1)                                         
  SORT FROM(T1) USING(CTL2)                                           
  COPY FROM(IN2) USING(CTL3)                                         
  SORT FROM(T2) USING(CTL4)                                           
//CTL1CNTL DD *                                                       
  OUTFIL FNAMES=T1,                                                   
  BUILD=(01,3,23,3,10:39,10,54,10,/,                                 
         23,3,23,3,10:39,10,54,10)                                   
//CTL2CNTL DD *                                                       
  SORT FIELDS=(1,29,CH,A)                                             
  SUM FIELDS=NONE                                                     
  OUTFIL FNAMES=T2,OVERLAY=(81:C'1')                                 
//CTL3CNTL DD *                                                       
  OUTFIL FNAMES=T2,OVERLAY=(81:X)                                     
//CTL4CNTL DD *                                                       
  SORT FIELDS=(1,3,CH,A,10,10,CH,A),EQUALS                           
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:4,3,10,20))
  OUTFIL FNAMES=OUT,BUILD=(1,80),                                     
  INCLUDE=(81,1,CH,EQ,C' ',AND,1,3,CH,LE,82,3,CH,AND,                 
           (10,10,CH,GE,95,10,CH,AND,10,10,CH,LE,85,10,CH))           
/*


The output from this job is

Code:

ABC      2009-01-01   TEST DATA LINE 1
ABC      2009-03-01   TEST DATA LINE 3
MNO      2009-02-02   TEST DATA LINE 5
Back to top
View user's profile Send private message
Michaelod
Warnings : 1

New User


Joined: 02 Sep 2008
Posts: 49
Location: Edinburgh

PostPosted: Tue Sep 22, 2009 5:51 pm
Reply with quote

You are right. I mixed up the expected output.

The code you provided works.

Excellent Thanks!
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top