View previous topic :: View next topic
Author
Message
tuxama New User Joined: 25 Jan 2007Posts: 42 Location: france
Hi all,
I have the following input file (lrecl=80, recfm=fb)
Code:
SORTIN DD *
234112
234113
234114
235116
235118
235119
237121
238122
238123
/*
I need to detect the break in the sequence in order to produce the output file below (lrecl=80, recfm=fb).
Code:
SORTOUT DD *
234112 235116
235116 235118
235118 237121
237121 238123
/*
I have no idea how to proceed or even if it is possible with a dfsort.
Can I have your opinion and your help ?
Thank you in advance
Back to top
enrico-sorichetti Superior Member Joined: 14 Mar 2007Posts: 10873 Location: italy
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Is this not a 'break' here? Considering 237 changed to 238 in the sequence number. Or was that a typo?
Back to top
tuxama New User Joined: 25 Jan 2007Posts: 42 Location: france
Big mistake
Code:
SORTOUT DD *
234112 234114
235116 235116
235118 235119
237121 237121
238122 238123
/*
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Like enrico mentioned, a little bit of coding might be a better choice, since this is pretty much straightforward.
I tried a quick DFSORT version and came up with this. Will post back if I can make it any better or if I find any bugs.
Code:
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN= Input (FB/80)
//SORTJNF2 DD DISP=SHR,DSN= Same Input (FB/80)
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(81,8,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(81,8,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,6,F2:1,6,?)
INREC IFTHEN=(WHEN=(13,1,CH,EQ,C'B'),
OVERLAY=(07:(7,6,ZD,ADD,+1),SUB,1,6,ZD,M11,LENGTH=6))
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(7,6,CH,NE,C'000000'),
PUSH=(15:1,6))
OUTFIL REMOVECC,NODETAIL,SECTIONS=(15,6,
TRAILER3=(15,6,X,1,6)),BUILD=(80X)
/*
//JNF1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD,START=0)
//JNF2CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
A friend of mine suggested this can be further simplified, So I have an updated version of the above, which needs only one input and does not need the JOIN operation.
Code:
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:SEQNUM,6,ZD,
81:1,6,ZD,SUB,81,6,ZD,M11,LENGTH=6)),
IFTHEN=(WHEN=GROUP,KEYBEGIN=(81,6),PUSH=(81:1,6))
OUTFIL REMOVECC,NODETAIL,SECTIONS=(81,6,
TRAILER3=(81,6,X,1,6)),BUILD=(80X)
Back to top
tuxama New User Joined: 25 Jan 2007Posts: 42 Location: france
Respect for this work Arun.
I am impressed.
Thank you very much for this solution that solves my problem.
Back to top
Please enable JavaScript!