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 

Repeat the data thru SORT

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


Joined: 17 Jul 2006
Posts: 3
Topics: 2

PostPosted: Fri Sep 29, 2006 4:42 am    Post subject: Repeat the data thru SORT Reply with quote

Hi,
Can we use SORT to get the o/p like below.

I am having 2 files. the file foramt is FB and record length is 80.

Code:

File-1 :

XXXXX
YYYYY
ZZZZZ

FILE-2:

123456
123457
123458
123459


I need to produce the o/p as below.

o/p file

Code:

XXXXX
123456
YYYYY     
ZZZZZ
XXXXX
123457
YYYYY     
ZZZZZ
XXXXX
123458
YYYYY     
ZZZZZ
XXXXX
123459
YYYYY     
ZZZZZ


The o/p file shoud contain the first record from first file and then the first record from second file and the 2 ns and 3 rd records from filrst file.Kind of generating a batch records.

Regards
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 Sep 29, 2006 7:22 am    Post subject: Reply with quote

entertpa,

Try this job

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
XXXXX                                                       
YYYYY                                                       
ZZZZZ                                                       
//SORTOUT  DD DSN=&S,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)   
//SYSIN    DD    *                                         
  SORT FIELDS=COPY                                         
  OPTION STOPAFT=3                                         
  OUTREC FIELDS=(C'REC',SEQNUM,1,ZD,C',''',01,10,C'''',80:X)
//*                                                         
//STEP0200 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SYMNAMES DD DSN=&S,DISP=OLD                               
//SORTIN   DD *                                             
123456                                                     
123457                                                     
123458                                                     
123459                                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD    *                                         
  SORT FIELDS=COPY                                         
  OUTFIL OUTREC=(REC1,/,                                   
                 01,80,/,                                   
                 REC2,/,                                   
                 REC3)                                     
/*


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
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