View previous topic :: View next topic
Author
Message
vinodjain New User Joined: 22 Oct 2010Posts: 4 Location: NJ
Hi,
I have two input files of size 70 Bytes each. Key is ( 1-13) is both the files.
O/p Length : 140 bytes ( Size of File 1 & File 2)
If the key in the first file matches with 2nd file , then need to add file contents ( other than key) to the first file record from 71st position.
Even for the duplicate record, I want the same info to be added as given in RED
Input File 1:
---------------
ATL1234567800YYY...................... YY
ATL1234567900YYY .................... YY
ATL1234568100YYY ...................... YY
ATL1234568100ZZZ ......................ZZ
Input File 2:
-------------
ATL1234567800XXX............AA
ATL1234567900XXX.............BB
ATL1234568100XXX.............CC
ATL9999999900XXX.............DD
O/p Required:
----------------
ATL1234567800YYY...................... YY ATL1234567800XXX............AA
ATL1234567900YYY .................... YY ATL1234567900XXX.............BB
ATL1234568100YYY ...................... YY ATL1234568100XXX.............CC
ATL1234568100ZZZ ......................ZZ ATL1234568100XXX.............CC
I tried with below JCL but duplicate records are NOT coming in the record
Code:
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=TSUEI4F.RVWDAT.JAN2AUG.SAMPLE,DISP=SHR
//IN2 DD DSN=TSUEI4F.DM.DRCLAIM.SAMPLE,DISP=SHR
//TEMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(CYL,(500,400),RLSE),
// UNIT=SYSDA
//COMBINE DD DSN=TSUEI4F.SAMPLE.OUTP59,
// DISP=(NEW,CATLG,CATLG),
// SPACE=(CYL,(500,400),RLSE),
// DCB=(RECFM=FB,LRECL=140,BLKSIZE=0)
//*
//TOOLIN DD *
COPY FROM(IN1) TO(TEMP1) USING(CTL1)
COPY FROM(IN2) TO(TEMP1) USING(CTL2)
SPLICE FROM(TEMP1) TO(COMBINE) ON(1,13,ZD) -
WITH(66,70)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,65,140:X)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1:1,13, PUT FILE2 KEY IN SAME PLACE AS FILE1 KEY
66:14,57) FILE2 DATA
/*
O/P of above JCL is :
ATL1234567800YYY...................... YY ATL1234567800XXX............AA
ATL1234567900YYY .................... YY ATL1234567900XXX.............BB
ATL1234568100YYY ...................... YY ATL1234568100XXX.............CC
Here the below duplicate record is missing.
ATL1234568100ZZZ ......................ZZ ATL1234568100XXX.............CC
Your help is highly appreciated.
Thanks,
Back to top
vinodjain New User Joined: 22 Oct 2010Posts: 4 Location: NJ
There was a typo in prev message with Output file required and what i am getting now.
O/p Required:
----------------
ATL1234567800YYY...................... YY XXX............AA
ATL1234567900YYY .................... YY XXX.............BB
ATL1234568100YYY ...................... YY XXX.............CC
ATL1234568100ZZZ ......................ZZ XXX.............CC
O/P of that I got using the JCL in pre message is :
ATL1234567800YYY...................... YY XXX............AA
ATL1234567900YYY .................... YY XXX.............BB
ATL1234568100YYY ...................... YY XXX.............CC
Back to top
nelson.pandian Active User Joined: 09 Apr 2008Posts: 133 Location: Phoenix, AZ
Hi Vinod,
The below DFSORT JCL will give you the desire Output. Assumed your RECFM=FB.
Code:
//STEP10 EXEC PGM=SORT
//*
//SYSOUT DD SYSOUT=*
//*
//SORTJNF1 DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
ATL1234567800YYY....................................................YY
ATL1234567900YYY ...................................................YY
ATL1234568100YYY ...................................................YY
ATL1234568100ZZZ ...................................................ZZ
/*
//*
//SORTJNF2 DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
ATL1234567800XXX....................................................AA
ATL1234567900XXX....................................................BB
ATL1234568100XXX....................................................CC
ATL9999999900XXX....................................................DD
/*
//*
//OUT DD SYSOUT=*
//*
//SYSIN DD * *** CONSTANT CONTROL CARDS ***
JOINKEYS FILES=F1,FIELDS=(1,13,A)
JOINKEYS FILES=F2,FIELDS=(1,13,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,70,?,F2:1,70)
OPTION COPY
OUTFIL FNAMES=OUT,INCLUDE=(71,1,CH,EQ,C'B'),BUILD=(1,70,85,57,13X)
/*
Hope this helps you.
Back to top
vinodjain New User Joined: 22 Oct 2010Posts: 4 Location: NJ
Thanks Nelson for the response. It worked.
Appreciate your help.
Thanks,
Vinod Jain
Back to top
vinodjain New User Joined: 22 Oct 2010Posts: 4 Location: NJ
Nelson, One question here:
Can you please explain me the below related to Include and Build parameters
OUTFIL FNAMES=OUT,INCLUDE=(71,1,CH,EQ,C'B'),BUILD=(1,70,85,57,13X)
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Vinod,
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
Please enable JavaScript!