View previous topic :: View next topic
Author
Message
sijayapal New User Joined: 23 Dec 2008Posts: 69 Location: India
Hi i am struck up with one silly logic.
I have used SORTOF option to split a input into three different files based on some include condition. But i need only 5 records in each file. If its a single file we can get it by using STOPAFT=5. But in multiple files this logic doesn't work.
i gave like this. But didnt work. i am getting only 5 recs in first file. Others are empty.
Code:
SORT FIELDS=COPY,STOPAFT=5
OUTFIL FILES=1,INCLUDE=(92,2,CH,EQ,C'AA')
OUTFIL FILES=2,INCLUDE=(92,2,CH,EQ,C'AB')
OUTFIL FILES=3,INCLUDE=(23,9,CH,EQ,C'AC')
I tried like this.. but getting syntax error.
Code:
SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(92,2,CH,EQ,C'AA'),STOPAFT=5
OUTFIL FILES=2,INCLUDE=(92,2,CH,EQ,C'AB'),STOPAFT=5
OUTFIL FILES=3,INCLUDE=(23,9,CH,EQ,C'AC'),STOPAFT=5
I think i forgot sort totally
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hello Sija,
You can use below sort card for this. Here i Have assumed that file length is 255 (FB)
Code:
INCLUDE COND=(92,2,SS,EQ,C'AA,AB,AC')
SORT FIELDS=(92,2,CH,A)
OUTREC IFTHEN=(WHEN=(92,2,CH,EQ,C'AA'),
OVERLAY=(256:SEQNUM,8,ZD))
IFTHEN=(WHEN=(92,2,CH,EQ,C'AB'),
OVERLAY=(256:SEQNUM,8,ZD))
IFTHEN=(WHEN=(92,2,CH,EQ,C'AC'),
OVERLAY=(256:SEQNUM,8,ZD))
OUTFIL FNAMES=OUT1,
INCLUDE=(92,2,CH,EQ,C'AA',AND,256,8,ZD,LE,+5),
BUILD=(1,255)
OUTFIL FNAMES=OUT2,
INCLUDE=(92,2,CH,EQ,C'AB',AND,256,8,ZD,LE,+5),
BUILD=(1,255)
OUTFIL FNAMES=OUT3,
INCLUDE=(92,2,CH,EQ,C'AC',AND,256,8,ZD,LE,+5),
BUILD=(1,255)
Back to top
sijayapal New User Joined: 23 Dec 2008Posts: 69 Location: India
Thanks guptae
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new OUTFIL ACCEPT=n function to do this quite easily like this:
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//OUT3 DD DSN=... output file3
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=(92,2,CH,EQ,C'AA'),ACCEPT=5
OUTFIL FNAMES=OUT2,INCLUDE=(92,2,CH,EQ,C'AB'),ACCEPT=5
OUTFIL FNAMES=OUT3,INCLUDE=(23,9,CH,EQ,C'AC'),ACCEPT=5
/*
For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
Back to top
dbzTHEdinosauer Global Moderator Joined: 20 Oct 2006Posts: 6966 Location: porcelain throne
Pretty soon DFSORT will be able to replace EZYTRIEVE,
SAS is next!
(yeah, yeah, I know neither is a goal of DFSORT - just a byproduct)
My regards and respect to the DFSORT Development Team
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Thanks for the kind words, Dick.
Back to top
Please enable JavaScript!