Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Selecting records from FILE 1 that meet FILE2 criteria

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Selecting records from FILE 1 that meet FILE2 criteria
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    Post subject:
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    Post subject:
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    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
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us