View previous topic :: View next topic
Author
Message
ganesh_bv New User Joined: 01 Nov 2008Posts: 9 Location: chennai
Here is the sample code snippet
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
1111 019 IN1
2222 020 IN1
4444 022 IN1
6666 024 IN1
8888 026 IN1
/*
//IN2 DD *
1111 019 IN2
2222 020 IN2
3333 021 IN2
4444 022 IN2
5555 023 IN2
6666 024 IN2
7777 025 IN2
8888 026 IN2
8888 IN2
8888 IN2
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=OUTFILE,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,1),RLSE)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) ON(18,3,CH) -
WITHALL WITH(1,81) KEEPNODUPS KEEPBASE USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(81,2,CH,EQ,C'VB'),
BUILD=(1,80)
/*
I want to know how overlay behaves in above example
particularly how the temp file formatted with VB
IN1 is overlayed with 'BB' and IN2 is ovelayed with 'VV' at 81:2 position and copied to temp file.
how the temp file will have 'VB' for same keys ?
as per my understanding the temp file will have following for key 1111
after IN1, IN2 copied.
Code:
1111 019 IN1 BB
1111 019 IN2 VV
Pls clarify me how we are expecting VB in temp file
Back to top
hikaps14 Active User Joined: 02 Sep 2005Posts: 189 Location: Noida
Hi,
Quote:
as per my understanding the temp file will have following for key 1111
after IN1, IN2 copied.
1111 019 IN1 BB
1111 019 IN2 VV
Pls clarify me how we are expecting VB in temp file
----------------------------------------------------------------------------------
Well you are correct, The temp file T1 wil have both these records after IN1 & IN2 have been copied to T1. There is no problem with overlay operator and it is works as you think.
Now, when you use splice operator with options :
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) ON(18,3,CH) -
WITHALL WITH(1,81) KEEPNODUPS KEEPBASE USING(CTL3)
/*
The trick here is WITH(1,81)
The WITH operator tells you to take the fields from 2nd record.
1111 019 IN1 BB
1111 019 IN2 VV
This will give o/p ( it takes 1,81 fron IN2 & 82 pos from IN1)
1111 019 IN2 VB
Please let me know if there is any further confusion.
Thanks,
-Kapil
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Back to top
ganesh_bv New User Joined: 01 Nov 2008Posts: 9 Location: chennai
Thanks for Kapil and Frank
Back to top
Please enable JavaScript!