|
View previous topic :: View next topic
|
| Author |
Message |
frenaud
New User
Joined: 15 Feb 2010 Posts: 5 Location: PARIS
|
|
|
|
Hi guys,
Below are the statements I've used to produce my output.
It works well, but I'm sure it could be more effective.
So, could you help me in this way ?
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DISP=SHR,DSN=ADCD.SIN1VB VB 20 (4+16)
//IN2 DD DISP=SHR,DSN=ADCD.SIN2FB FB 8
//T1 DD DSN=&&TEMP1, VB 20+4+12 (4+16 + 4+12)
// UNIT=SYSDA,SPACE=(TRK,(5,0)),DISP=(MOD,PASS)
//T2 DD DSN=&&TEMP2, VB 20+4+12 (4+16 + 4+12)
// UNIT=SYSDA,SPACE=(TRK,(5,0)),DISP=(MOD,PASS)
//OUT DD DISP=SHR,DSN=ADCD.SOUTVB VB 20 (4+16)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(25,12,PD) KEEPNODUPS WITHEACH -
WITH(10,8) USING(CTL3)
COPY FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,BUILD=(1,4,5,16,25:SEQNUM,12,PD),VLFILL=C' '
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T1,FTOV,BUILD=(6:1,8,21:SEQNUM,12,PD)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=T2,
OVERLAY=(6:6,8)
/*
//CTL4CNTL DD *
OUTFIL FNAMES=OUT,
IFTHEN=(WHEN=NONE,BUILD=(1,4,5,16))
/*
here are :
- the first input (recfm=VB lrecl=20) :
----+----1----+-
aaaaabbbbbbbbccc
dddddeeeeeee fff
gggg hhhhhhhh ii
jjjjjkkkkkkkklll
dddddeeeeeee fff
mmm nnnnn o
- the second input (recfm=FB lrecl=8) :
----+---
11111111
22222
3333333
4444
22222
555
- the output is like this (recfm=VB lrecl=20):
----+----1----+-
aaaaa11111111ccc
ddddd22222 fff
gggg 3333333 ii
jjjjj 4444 lll
ddddd22222 fff
mmm 555 o
|
In fact, the field (1,8) in the second input file replaces the field in the first input file at offset 6.
Thanks. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
frenaud,
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports the JOINKEYS function which can create the seqnum and use that as a match key as shown below to give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=Your input FB 8 byte file,DISP=SHR
//SORTJNF2 DD DSN=your input VB 20 byte file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS FILES=F1,FIELDS=(09,12,A)
JOINKEYS FILES=F2,FIELDS=(05,12,A)
REFORMAT FIELDS=(F2:1,4,17,5,F1:1,8,F2:30)
//JNF1CNTL DD *
INREC BUILD=(1,8,SEQNUM,12,ZD)
//JNF2CNTL DD *
INREC BUILD=(1,4,SEQNUM,12,ZD,5)
//* |
For complete details on JOINKEYS and the other new functions available with the Nov, 2009 DFSORT PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
If your shop doesn't have the PTF installed , here is an alternative version which will give you the desired results
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your 8 byte FB file,DISP=SHR
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//HDR DD DSN=&&HD,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,8,16:X)
OUTFIL FTOV
OUTFIL FNAMES=HDR,ENDREC=1,FTOV,BUILD=(16C'$')
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&HD,DISP=SHR,VOL=REF=*.STEP0100.HDR
// DD DSN=&&T1,DISP=SHR
// DD DSN=&&HD,DISP=SHR,VOL=REF=*.STEP0100.HDR
// DD DSN=Your VB 20 byte file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,13X,5)),
IFTHEN=(WHEN=GROUP,BEGIN=(18,16,CH,EQ,C'$$$$$$$$$$$$$$$$'),
PUSH=(5:ID=1,SEQ=12))
SORT FIELDS=(6,12,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(5,1,ZD,EQ,1,AND,6,12,ZD,GT,1),
PUSH=(23:18,8),RECORDS=2)
OUTFIL INCLUDE=(5,1,ZD,EQ,2,AND,6,12,ZD,GT,1),BUILD=(1,4,18)
//* |
|
|
| Back to top |
|
 |
frenaud
New User
Joined: 15 Feb 2010 Posts: 5 Location: PARIS
|
|
|
|
Thanks Kolusu.
But my April, 2006 DFSORT V1R5 level won't permit any of the 2 solutions.
So, can't we bring together CTL3CNTL and CTL4CNTL ?
Thanks. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
frenaud,
Here is a DFSORT/ICETOOL JCl which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FB DD DSN=Your FB file,DISP=SHR
//VB DD DSN=your VB file,DISP=SHR
//TEMP DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(VB) USING(CTL1)
COPY FROM(FB) USING(CTL2)
SPLICE FROM(TEMP) TO(OUT) ON(5,12,ZD) KEEPNODUPS WITHEACH -
WITH(23,8) USING(CTL3)
//CTL1CNTL DD *
INREC BUILD=(1,4,SEQNUM,12,ZD,C'V',5)
OUTFIL FNAMES=TEMP
//CTL2CNTL DD *
INREC BUILD=(SEQNUM,12,ZD,C'F',5X,1,8,3X)
OUTFIL FNAMES=TEMP,FTOV
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(17,1,CH,EQ,C'V'),BUILD=(1,4,18)
//* |
|
|
| Back to top |
|
 |
frenaud
New User
Joined: 15 Feb 2010 Posts: 5 Location: PARIS
|
|
|
|
| It works. Thanks Kolusu. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|