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
 

 

matched & unmatched recs frm file1 based on keys frm fil

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: matched & unmatched recs frm file1 based on keys frm fil
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

Site Director


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

PostPosted: Mon Jun 23, 2008 4:24 am    Post subject:
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    Post subject: Reply to: matched & unmatched recs frm file1 based on ke
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    Post subject:
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

Site Director


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

PostPosted: Tue Jun 24, 2008 12:36 am    Post subject: Reply to: matched & unmatched recs frm file1 based on ke
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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 0 Tue Jan 17, 2017 4:26 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts For each given key value, how to keep... Div Grad DFSORT/ICETOOL 7 Fri Nov 11, 2016 11:38 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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