MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
hari108 Beginner Joined: 03 Feb 2006 Posts: 16 Topics: 4
Posted: Thu Aug 07, 2008 8:10 am Post subject: Skipping a group of records using SORT
Hi,
I have a file with RECFM=FBA and LRECL=133 that contains a number of reports (up to n). Each report consists of a header which is of 7 lines followed by the detail lines for that report. Each report can have a different number of detail lines. For example:
Page Header line1
Page Header line2
:
:
:
Page Header line6
Page Header line7
Detail line1
Detail line2
Detail line3
:
:
:
:
Detail line(n)
Page Header line1
Page Header line2
:
:
:
Page Header line6
Page Header line7
Detail line1
Detail line2
Detail line3
:
:
:
:
Detail line(n)
Sample Header Line:
Code: Process Date: 08/12/07
Process Time: 20:08:41
Rel: 0791
Detail Report
Sample Detail Line:
Code: Some data
Some data
Some data
Some data
Some data
Some data
My requirement is that I need to OMIT all the Page Header lines i.e the 7 header lines and RETAIN only the detail line to a output file.
Any help in this regard is most appreciated!! _________________ Thanks,
Hari
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Aug 07, 2008 11:16 am Post subject:
You can do this kind of thing quite easily with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008).
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FBA/133)
//SORTOUT DD DSN=... output file (FBA/133)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(2,13,CH,EQ,C'Process Date:'),RECORDS=7,
PUSH=(134:ID=1))
OUTFIL OMIT=(134,1,CH,NE,C' '),BUILD=(1,133)
/*
For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
If you don't have PTF UK90013, you can use this more complex DFSORT job:
Code:
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FBA/133)
//SORTOUT DD DSN=... output file (FBA/133)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(2,13,CH,EQ,C'Process Date:'),
OVERLAY=(134:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(142:SEQNUM,8,ZD,
134:134,8,ZD,SUB,142,8,ZD,TO=ZD,LENGTH=8))
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(150:SEQNUM,8,ZD,RESTART=(134,8)))
OUTFIL OMIT=(150,8,ZD,LE,7),BUILD=(1,133)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
hari108 Beginner Joined: 03 Feb 2006 Posts: 16 Topics: 4
Posted: Fri Aug 08, 2008 2:46 am Post subject:
Hi Frank,
Thank you so much for your solution. your seconod soln worked for me... _________________ Thanks,
Hari
Back to top
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