View previous topic :: View next topic
Author
Message
k.junaid83 New User Joined: 19 Apr 2006Posts: 22 Location: bangalore
Hi All,
I am trying to combine a feild which is present in three different files (not having same LRECL) into one file.My code is
Code:
//STEP01 EXEC PGM=ICETOOL,
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFIL1 DD DSN=FILE1,DISP=SHR
//INFIL2 DD DSN=FILE2,DISP=SHR
//INFIL3 DD DSN=FILE3,DISP=SHR
//TMP1 DD DSN=&&TMP,DISP=(MOD,PASS),
// SPACE=(CYL,(10,10)),
// UNIT=SYSDA
//OUTFIL DD DSN=FILE4,
// UNIT=(SYSDA,10),DISP=(NEW,CATLG),
// SPACE=(CYL,(10,5),RLSE)
//TOOLIN DD *
COPY FROM(INFIL1) TO(TMP1) USING(CTL1)
COPY FROM(INFIL2) TO(TMP1) USING(CTL2)
COPY FROM(INFIL3) TO(TMP1) USING(CTL3)
SPLICE FROM(TMP1) TO(OUTFIL) ON(1,12,ZD) WITH(13,5)
/*
//CTL1CNTL DD *
OUTREC FIELDS= (1:5197,7,PD,TO=ZD,LENGTH=12)
/*
//CTL2CNTL DD *
OUTREC FIELDS= (14:159,6,PD,TO=ZD,LENGTH=12)
/*
//CTL3CNTL DD *
OUTREC FEILDS =(27:3,6,PD,TO=ZD,LENGTH=12)
/*
//
The feild(Emp no) which I am trying to combine is common in the three input files .
The Input and output looks like
Feild in File1 :
111222333444
111333222444
222111333444
222333111444
Feild in File2:
111333222444
222111333444
222333111444
333111222444
Feild in File3:
222111333444
222333111444
333111222444
444111222333
The output I am getting is
111333222444111333222444
222111333444222111333444
But the expected outputs is
111222333444 111333222444 222111333444
111333222444 222111333444 222333111444
222111333444 222333111444 333111222444
222333111444 333111222444 444111222333
Please let me know where I am going wrong ? Thanks
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
I think you may have to do it in two goes, SPLICE IN1 & IN2 to give OUT1, and then SPLICE IN3 with OUT1.
Back to top
murmohk1 Senior Member Joined: 29 Jun 2006Posts: 1436 Location: Bangalore,India
junaid83,
You need to use WITHALL option followed by 2 with options like
Code:
SPLICE FROM(TMP1) TO(OUTFIL) ON(1,12,ZD)
WITHALL WITH(13,5) WITH(27,5)
Note: Please change WITH(27,5) according to your third record position
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
k.junaid83,
I don't see how you could have gotten the output you show with the job you show.
It appears you want to splice the fields record-by-record. In order to do that, you need to add a sequence number to each record and use SPLICE with WITHEACH. Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//STEP01 EXEC PGM=ICETOOL,
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFIL1 DD DSN=FILE1,DISP=SHR
//INFIL2 DD DSN=FILE2,DISP=SHR
//INFIL3 DD DSN=FILE3,DISP=SHR
//TMP1 DD DSN=&&TMP,DISP=(MOD,PASS),
// SPACE=(CYL,(10,10)),
// UNIT=SYSDA
//OUT DD DSN=FILE4,
// UNIT=(SYSDA,10),DISP=(NEW,CATLG),
// SPACE=(CYL,(10,5),RLSE)
//TOOLIN DD *
COPY FROM(INFIL1) TO(TMP1) USING(CTL1)
COPY FROM(INFIL2) TO(TMP1) USING(CTL2)
COPY FROM(INFIL3) TO(TMP1) USING(CTL3)
SPLICE FROM(TMP1) TO(OUTFIL) ON(1,12,ZD) WITH(13,5) -
USING(CTL4)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1:5197,7,PD,TO=ZD,LENGTH=12)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(14:159,6,PD,TO=ZD,LENGTH=12)
/*
//CTL3CNTL DD *
OUTREC FEILDS=(27:3,6,PD,TO=ZD,LENGTH=12)
/*
//CTL4CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,38)
/*
Back to top
aneeta New User Joined: 08 Dec 2005Posts: 48 Location: Chennai
Hi Frank,
Pls Can u explain TO=ZD,LENGTH=12 in
OUTREC FIELDS=(14:159,6,PD,TO=ZD,LENGTH=12)?
Thanks
Aneeta
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Code:
14:159,6,PD,TO=ZD,LENGTH=12
converts the 6-byte PD value starting at input position 159 to a 12-byte ZD value starting at output position 14.
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:
Use [URL] BBCode for External Links
Back to top
Please enable JavaScript!