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

matched & unmatched recs frm file1 based on keys frm fil


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

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Mon Jun 23, 2008 2:58 am
Reply with quote

Hi ,

There are two files - 400 byte INPUT file nd 4 byte CONTROL file. The key field of the INPUT file is of S9(4) comp and starts at position 44.

Examples

CONTROL file
+++4
1000
2000
3000

INPUT file

+++++++++++++++4444++++++++++++++++++4
+++++++++++++++4567++++++++++++++++++0
++++++++++++++++++++++++++++++++++++0
qweqwe.......................1000.....................................
fbgjkdhfg.....................1000......................................
nbmnvcbvm.................3000.....................................
uewyrwei.....................4000.....................................
nbvccv........................4000.....................................

I have to write out two output files of 400 bytes -

1. One output file contains all records of the INPUT file whose key cannot be found in the 4 byte CONTROL file(unmatched records)

Example

uewyrwei.....................4000.....................................
nbvccv........................4000.....................................

2. Other file contains all records of the INPUT file whose key can be found in the 4 byte CONTROL file(matched records)

Example

qweqwe.......................1000.....................................
fbgjkdhfg.....................1000......................................
nbmnvcbvm.................3000.....................................

The [r]catch[/r] is that the INPUT file can have duplicate records.
I have already tried it but the step writes only the first of the duplicate records to the output file 2 ; the rest are written to output file 1

Pasting the step I created....

Code:

//TOOLIN DD *
SELECT FROM(IN1) TO(F1) ON(44,4,BI) FIRST
COPY    FROM(IN2) TO(T1) USING(CTL1)
SELECT FROM(T1)  TO(F1) ON(44,4,BI) FIRST
SELECT FROM(F1)  TO(T2) ON(44,4,BI) FIRST FIRSTDUP USING(CTL2)
SELECT FROM(F1)  TO(T2) ON(44,4,BI) NODUPS USING(CTL3)
COPY FROM(IN1)   TO(T2) USING(CTL4)
COPY FROM(T1)    TO(T2) USING(CTL5)
SPLICE FROM(T2) TO(OUT1) ON(44,4,BI) -
  WITHALL WITH(1,402) USING(CTL6)
/*
//CTL1CNTL DD *
  INREC BUILD=(44:1,4,399:C'22')
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=T2,OVERLAY=(401:C'DD')
/*
//CTL3CNTL DD *.
  OUTFIL FNAMES=T2,OVERLAY=(401:C'UU')
/*
//CTL4CNTL DD *
  OUTFIL FNAMES=T2,OVERLAY=(401:C'11')
/*
//CTL5CNTL DD *
  OUTFIL FNAMES=T1,OVERLAY=(401:C'22')
/*
//* ONLY FILE 1 RECS
//CTL6CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(401,2,CH,EQ,C'1U'),
    BUILD=(1,400)
  OUTFIL FNAMES=OUT12,SAVE,
    BUILD=(1,400)
/*


Could you tell me where I have gone wrong or I am completely wrong???

Ayush
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 23, 2008 4:24 am
Reply with quote

Hello Ayush and welcome to the forums,

Please look at this previous topic and see if it helps:
http://ibmmainframes.com/viewtopic.php?t=27320
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Tue Jun 24, 2008 12:21 am
Reply with quote

Tnx a zillion !!!!!!!!
Back to top
View user's profile Send private message
ayushT

New User


Joined: 01 Oct 2007
Posts: 23
Location: india

PostPosted: Tue Jun 24, 2008 12:25 am
Reply with quote

That link helped a lot, though I did play around with the key words like keepbase & keepno dupes

I had to do a small modification because my key in the INPUT file was @ pos 44 to 47


Code:

//TOOLIN   DD *                                                         
  COPY   FROM(IN2) TO(T1)   USING(CTL2)                                 
  COPY   FROM(IN1) TO(T1)   USING(CTL1)                                 
  SPLICE FROM(T1)  TO(OUT1) ON(44,04,BI) WITH(1,400) WITH(401,1) -   
  WITHALL KEEPBASE USING(CTL3) KEEPNODUPS                               
/*                                                                     
//CTL1CNTL DD *                                                         
  OUTREC BUILD=(1,400,401:C'22')                                       
/*                                                                     
//CTL2CNTL DD *                                                         
  OUTREC BUILD=(44:01,04,401:C'11')                                     
/*                                                                     
//CTL3CNTL DD *                                                         
  OUTFIL FNAMES=OUT1,INCLUDE=(401,2,CH,EQ,C'21'),BUILD=(1,400)         
  OUTFIL FNAMES=OUT2,INCLUDE=(401,2,CH,EQ,C'22'),BUILD=(1,400)         
/*
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jun 24, 2008 12:36 am
Reply with quote

You're welcome icon_smile.gif

Good to hear it is working and thank you for the update.

d
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 Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
No new posts To search DB2 table based on Conditio... DB2 1
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
Search our Forums:

Back to Top