MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copy all records until a condition is satisfied

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Thu Aug 09, 2007 11:41 pm    Post subject: Copy all records until a condition is satisfied Reply with quote

HI,

I have a requirement where in I want to copy all the records until a specific condition is satisfied.

Can we obtain this using syncsort?

Input:

AAAAA
BBBBB
BBBBB
CCCCC
EEEEEE
FFFFFFF

OUTPUT:
AAAAA
BBBBB
BBBBB

Sort condition : Stop copying when finding 'CCCCC'. (It can be in anywhere in the file).

Thanks,
Vivek G
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Aug 10, 2007 6:24 am    Post subject: Reply with quote

vivek1983,

Try this


Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR                       
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//SYSIN    DD *                                         
 SORT FIELDS=COPY                                       
 INREC FIELDS=(01,10,SEQNUM,8,ZD,START=0,INCR=1)         
 OUTFIL INCLUDE=(1,5,CH,EQ,C'CCCCC'),                   
 REMOVECC,NODETAIL,                                     
 OUTREC=(01,18,80:X),                                   
 TRAILER1=(' OPTION COPY,STOPAFT=',                     
           MIN=(11,8,ZD,M11,LENGTH=8),80:X)             
/*                   
//STEP0200 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR   
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD DSN=&T1,DISP=SHR     
/*


OR if your shop has file-aid then you can use this 1 step job

Code:

//STEP0100 EXEC PGM=FILEAID           
//SYSPRINT DD SYSOUT=*               
//SYSLIST  DD SYSOUT=*               
//DD01     DD DSN=YOUR INPUT FILE,
//            DISP=SHR               
//DD01O    DD  SYSOUT=*               
//SYSIN    DD  *                     
$$DD01 COPY STOP=(1,EQ,C'CCCCC'),OUT=0
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Fri Aug 10, 2007 6:41 am    Post subject: Reply with quote

kolusu,

Thanks a lot for your replies !

I used File-Aid solution. It works exactly the way I wanted it to work.

Thanks,
Vivek G
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group