View previous topic :: View next topic
Author
Message
Vikas Maharnawar New User Joined: 19 Apr 2017Posts: 6 Location: india
Hi
I have Two input files
Input File 1
Code:
AAA BBB CCC DDDD
PPP PPP QQQ SSSS
EEE FFF GGG HHHH
KKK LLL MMM NNNN
SSS TTT SSS JJJJ
FLD(7,2) == '03',
FLD(7,2) == '04',
FLD(7,2) == '05',
FLD(7,2) == '06',
FLD(7,2) == '07',
XYZ XYX XXX
PQR MNO
Input file 2
Output file
Code:
AAA BBB CCC DDDD
PPP PPP QQQ SSSS
EEE FFF GGG HHHH
KKK LLL MMM NNNN
SSS TTT SSS JJJJ
FLD(7,2) == '12',
FLD(7,2) == '13',
FLD(7,2) == '14',
FLD(7,2) == '15',
FLD(7,2) == '16',
XYZ XYX XXX
PQR MNO
I want to replace records using JCL . kindly help me to get expected output.
Thanks in advance!!!
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10872 Location: italy
show us what You have done to help Yourself,
a forum is for help...
no for just dropping a problem and asking for a solution
Back to top
Nic Clouston Global Moderator Joined: 10 May 2007Posts: 2455 Location: Hampshire, UK
Well, you may want to use JCL and I do not see what problem you are having as the JCL required to run DFsort is explained in the DFsort manual. But JCL by itself cannot do what you want - you need utility, in this case DFsort, control statements. So what have you tried so far (you are in the expert's forum not the Beginners so you should have tried something)?
Please use the code tags when posting code and data and note that on the mainframe data is held in data sets not files.
(I was going to edit your posgt to make it use the code tags but I see that Enrico got there first!)
Back to top
Vikas Maharnawar New User Joined: 19 Apr 2017Posts: 6 Location: india
I written below JCl
Code:
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=XYZ,DISP=SHR
//IN2 DD DSN=PQR,DISP=SHR
//TEMP DD DSN=&&TEMP,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=ABC,DISP=(NEW,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),
// UNIT=3390,SPACE=(TRK,(10,10),RLSE)
//TOOLIN DD *
COPY FROM(IN1) TO(TEMP) USING(CTL1)
COPY FROM(IN2) TO(TEMP) USING(CTL2)
SPLICE FROM(TEMP) TO(OUT) ON(81,2,ZD) WITH(14,02) USING(CTL3)
//CTL1CNTL DD *
INREC BUILD=(1,17,81:SEQNUM,2,ZD)
/*
//CTL2CNTL DD *
INREC BUILD=(14:1,02,81:SEQNUM,2,ZD)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
Job gives below Output to me
Code:
AAA BBB CCC D12D
PPP PPP QQQ S13S
EEE FFF GGG H14H
KKK LLL MMM N15N
SSS TTT SSS J16J
Coded - again
Back to top
Nic Clouston Global Moderator Joined: 10 May 2007Posts: 2455 Location: Hampshire, UK
3 things:
1 - learn to use the code tags - use the full reply editor not the quick reply.
2 - the experts will probably say that you should use JOINKEYS - look in the forum for various examples.
3 - you probably should not provide DCB info on your output DD name.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Are the contents of your input-1 static?
Will there be the same number of records in input-1, each time?
Will there be the same number of records in input-2, each time?
Like Nic pointed out, you might be able to achieve this without SPLICEing.
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3048 Location: NYC,USA
With the given input, this will work.
Code:
----+----1----+----2----+
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
AAA BBB CCC DDDD
PPP PPP QQQ SSSS
EEE FFF GGG HHHH
KKK LLL MMM NNNN
SSS TTT SSS JJJJ
FLD(7,2) == '03',
FLD(7,2) == '04',
FLD(7,2) == '05',
FLD(7,2) == '06',
FLD(7,2) == '07',
XYZ XYX XXX
PQR MNO
//INB DD *
12
13
14
15
16
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS F1=INA,FIELDS=(25,2,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(25,2,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,20,F2:1,2,?)
OUTREC IFOUTLEN=20,
IFTHEN=(WHEN=(14,2,CH,EQ,C'03'),OVERLAY=(14:21,2)),
IFTHEN=(WHEN=(14,2,CH,EQ,C'04'),OVERLAY=(14:21,2)),
IFTHEN=(WHEN=(14,2,CH,EQ,C'05'),OVERLAY=(14:21,2)),
IFTHEN=(WHEN=(14,2,CH,EQ,C'06'),OVERLAY=(14:21,2)),
IFTHEN=(WHEN=(14,2,CH,EQ,C'07'),OVERLAY=(14:21,2))
//JNF1CNTL DD *
INREC OVERLAY=(25:SEQNUM,2,ZD)
//JNF2CNTL DD *
INREC OVERLAY=(25:SEQNUM,2,ZD,START=6,INCR=1)
//*
Back to top
RahulG31 Active User Joined: 20 Dec 2014Posts: 446 Location: USA
Rohit,
I modified your card a little so that the result is not dependent on input values, rather on some input key (in this case position 1-3 = FLD).
Code:
//SYSIN DD *
SORT FIELDS=COPY
JOINKEYS F1=INA,FIELDS=(25,2,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(25,2,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,20,F2:1,2,?)
OUTREC IFOUTLEN=20,
IFTHEN=(WHEN=(1,3,CH,EQ,C'FLD'),OVERLAY(14:21,2))
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'FLD'),OVERLAY=(25:SEQNUM,2,ZD))
/*
//JNF2CNTL DD *
INREC OVERLAY=(25:SEQNUM,2,ZD)
/*
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3048 Location: NYC,USA
RahulG31, much better way of doing it. Thanks.
Back to top
Vikas Maharnawar New User Joined: 19 Apr 2017Posts: 6 Location: india
It works successfully.
Thank you all of you for giving your valuable time and helping me.
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3048 Location: NYC,USA
Welcome here!.
Back to top
Please enable JavaScript!