View previous topic :: View next topic
Author
Message
ayushT New User Joined: 01 Oct 2007Posts: 23 Location: india
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
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Back to top
ayushT New User Joined: 01 Oct 2007Posts: 23 Location: india
Tnx a zillion !!!!!!!!
Back to top
ayushT New User Joined: 01 Oct 2007Posts: 23 Location: india
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
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
You're welcome
Good to hear it is working and thank you for the update.
d
Back to top
Please enable JavaScript!