Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort to select few records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sort to select few records
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: 1187
Location: Bangalore,India

PostPosted: Thu Jan 21, 2010 1:53 pm    Post subject:
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    Post subject:
Reply with quote

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

DFSORT Moderator


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

PostPosted: Fri Oct 29, 2010 1:17 am    Post subject:
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:

http://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: 6967
Location: porcelain throne

PostPosted: Fri Oct 29, 2010 1:24 am    Post subject:
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 Moderator


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

PostPosted: Fri Oct 29, 2010 1:41 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us