Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Sat Dec 25, 2004 6:16 am Post subject:
Alain,
I have one question. Is there a way to differentiate two Headers/Trailers. Something like HDR1, HDR2....(where the number differentiates the two headers) ?
Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Sat Dec 25, 2004 9:21 am Post subject:
Phantom,
The only thing you can test is 'HDR' and 'TRL'. What comes after is unpredictable.
The numbers are just here to say that you have to preserve the coherence in the final solution.
So no, there is no way to differentiate HDR/TRL between them...
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Tue Dec 28, 2004 7:33 am Post subject:
Alain,
Do you have a solution for this (using existing versions of Syncsort/Dfsort)? If so, how many pass did u take ? (Don't give me the solution. Just tell me how many passes you took).
After breaking my head for the past 2-3 days I think I got a solution (using OLD Syncsort V 3.7). But I can't guarantee on the no. of passes. The no. of passes will be dependant (vary dynamically) on the no. of Headers.
Total no. of Passes =
2 full pass on the input data +
(2 * n) passes over dynamically created control cards. (Where n = no. of headers).
NOTE: There will be only 1 SORT over the data. Others are just COPY
Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Tue Dec 28, 2004 10:35 am Post subject:
Phantom,
I have a solution for the both cases. I wrote it with dfsort for a syncsort user. The feedback i had is that the solution is compatible. But I don't know what syncsort 3.7 can do.
The solution I will give has none restriction., none dependancies...
For HDR&Details = 2 passes
For HDR,Details&TRL = 3 passes
With the new dfsort features, only 1 pass and 1 jcl responds for the both cases !
My opinion, phantom, is that you shouldn't spend your free time finding a restricted solution; but a global one.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Tue Dec 28, 2004 10:51 am Post subject:
Alain,
Code:
For HDR&Details = 2 passes
Uffff....Pal, I'm dead. !!!!
In the link that you posted with ur question, Kolusu had said that he can't think if a way to achieve this using the traditional features of Sort. Me too...Can't think of a direct way.
I just can't keep thinking of the samething again & again. Could you please send ur solution Offline. I completed my solution, it takes 2 * n + 3 passes (where n = no. of headers), out of which (2 * n) passes were required just to convert the data as shown below.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Thu Dec 30, 2004 2:44 am Post subject:
Alain,
Code:
For HDR,Details&TRL = 3 passes
Kolusu gave me his solution with 2 Passes for HDR + Detail records. I just modified it a bit for HDR + Detail + TRL records. And that also took just 2 passes. I have sent you (& Kolusu) the solution Offline.
Code:
I send you the logic & the jcl offline.
I didn't receive any note from you yet. Could you please resend your solutions.
Joined: 04 May 2003 Posts: 92 Topics: 4 Location: Paris, France
Posted: Wed Jan 05, 2005 8:26 am Post subject:
The logic is identical for the both cases.
Code:
Col1 Col2 Col3 Col4 Col5 Col6
HDR1 00001 00001 00001 A
A 00002 00001 00001 B
TRL1 00003 00002 00001 B
HDR2 00004 00002 00002 A
A 00005 00003 00002 B
TRL2 00006 00004 00002 B
HDR3 00007 00003 00003 A
C 00008 00005 00003 B
B 00009 00006 00003 B
A 00010 00007 00003 B
TRL3 00011 00008 00003 B
HDR4 00012 00004 00004 A
D 00013 00009 00004 B
C 00014 00010 00004 B
B 00015 00011 00004 B
A 00016 00012 00004 B
TRL4 00017 00013 00004 B
Col2: INREC SEQNUM all the records
Col3: SEQNUM only EQ,C'HDR'
Col4: SEQNUM only NE,C'HDR'
COL5: IF Col1='HDR' THEN Col5=Col3
ELSE Col5=Col2-Col4
Col6: IF Col1='HDR' THEN Col6='A'
ELSE Col6='B'
Here is the jcl for HDR only.
Code:
//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(ICE0)
SORT FROM(MERGE) TO(OUTX) USING(ICE1)
/*
//IN DD *
HDR1
A
HDR2
B
A
HDR3
C
B
A
HDR4
D
C
B
A
/*
//OUT1 DD DSN=&&ST01FI01,
// DISP=(NEW,DELETE,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(1,0,0),RLSE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=96)
//OUT2 DD DSN=&&ST01FI02,
// DISP=(NEW,DELETE,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(1,0,0),RLSE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=96)
//MERGE DD DSN=*.OUT1,VOL=REF=*.OUT1,DISP=(SHR,DELETE,DELETE)
// DD DSN=*.OUT2,VOL=REF=*.OUT2,DISP=(SHR,DELETE,DELETE)
//OUTX DD SYSOUT=*
//ICE0CNTL DD *
INREC FIELDS=(1,80,SEQNUM,5,ZD,START=1,INCR=1)
OUTFIL FNAMES=OUT1,
INCLUDE=(1,3,CH,EQ,C'HDR'),
OUTREC=(1,80,C'00000',SEQNUM,5,ZD,START=1,INCR=1,C' A')
OUTFIL FNAMES=OUT2,
OMIT=(1,3,CH,EQ,C'HDR'),
OUTREC=(1,85,SEQNUM,5,ZD,START=1,INCR=1,C' B')
/*
//ICE1CNTL DD *
OPTION EQUALS
INREC FIELDS=(1,90,(81,5,ZD,SUB,86,5,ZD),M11,LENGTH=5,96,1)
SORT FIELDS=(91,5,ZD,A,96,1,CH,A,1,1,CH,A)
OUTREC FIELDS=(1,80)
/*
Here are the jcl for HDR&TRL from Phantom & Kolusu very similar to each one
Code:
//STEP0100 EXEC PGM=SYNCTOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD *
HDR1
A
TLR1
HDR2
B
A
TLR2
HDR3
C
B
A
TLR3
HDR4
D
C
B
A
TLR4
//T1 DD DSN=&&T1,DISP=(,PASS)
//T2 DD DSN=&&T2,DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR
// DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(CON) USING(CTL2)
//CTL1CNTL DD *
INREC FIELDS=(1,80,SEQNUM,8,ZD)
OUTFIL FNAMES=T1,INCLUDE=(1,3,CH,EQ,C'HDR'),
OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H')
OUTFIL FNAMES=T2,SAVE,
OUTREC=(1,88,SEQNUM,8,ZD,C'Z')
//CTL2CNTL DD *
OPTION EQUALS
INREC FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,1)
SORT FIELDS=(97,8,ZD,A,105,1,CH,A,1,3,CH,A)
OUTREC FIELDS=(1,80)
OUTFIL FNAMES=OUT
/*
Code:
//STEP0100 EXEC PGM=SYNCTOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD *
HDR1
A
TLR1
HDR2
B
A
TLR2
HDR3
C
B
A
TLR3
HDR4
D
C
B
A
TLR4
//T1 DD DSN=&&T1,DISP=(,PASS)
//T2 DD DSN=&&T2,DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR
// DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(CON) USING(CTL2)
//CTL1CNTL DD *
INREC FIELDS=(1,80,SEQNUM,8,ZD)
OUTFIL FNAMES=T1,INCLUDE=(1,3,CH,EQ,C'HDR'),
OUTREC=(1,80,8C'0',SEQNUM,8,ZD,C'H')
OUTFIL FNAMES=T2,SAVE,
OUTREC=(1,88,SEQNUM,8,ZD,
1,3,CHANGE=(1,C'TLR',C'Z'),NOMATCH=(C'I'))
//CTL2CNTL DD *
OPTION EQUALS
INREC FIELDS=(1,96,(81,8,ZD,SUB,89,8,ZD),M11,LENGTH=8,97,1)
SORT FIELDS=(97,8,ZD,A,105,1,CH,A,1,3,CH,A)
OUTREC FIELDS=(1,80)
OUTFIL FNAMES=OUT
/*
The only thing I can say is that those 2 solutions are better than mine !
I think there is no interest for me to post mine solution : I am simply beaten.
The interest of this challenge was also to reveal that the DFSORT UQ95213 or UQ95214
reduces the number of passes to 1 and that the solution is compatible for the both cases.
Frank gave me a hand really nice on this.
Here are the xxxxCNTL statements :
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum