IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort to select few records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Thu Jan 21, 2010 11:33 am
Reply with quote

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 icon_eek.gif
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Jan 21, 2010 1:53 pm
Reply with quote

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
View user's profile Send private message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Fri Jan 22, 2010 10:50 am
Reply with quote

Thanks guptae
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 29, 2010 1:17 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Oct 29, 2010 1:24 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 29, 2010 1:41 am
Reply with quote

Thanks for the kind words, Dick. icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top