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 

Sort and Rearrange

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


Joined: 17 Dec 2002
Posts: 53
Topics: 14
Location: BengaLuru

PostPosted: Thu Mar 06, 2003 9:59 am    Post subject: Sort and Rearrange Reply with quote

Hello,

There is a PS file containing records like :

Code:

AAAAAA
BBBBBB
CCCCCC
DDDDDD
EEEEEE
FFFFFF


Is it possible to re-arrange the file as:

Code:

ABCDEF
ABCDEF
ABCDEF
ABCDEF
ABCDEF
ABCDEF


Using SORT/ICETOOL ?
Idea

If the first file were not in the sorted order as given, but looks like,
Code:

ACBFED
BDECAB
CFFABC
DACDCA
FBABDE
EEDEFF


how is it possible to achieve the same result using sort utlities ?

Regards,
_________________
If you're not failing every now and again, it's a sign you're not doing anything very innovative.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Mar 06, 2003 1:38 pm    Post subject: Reply with quote

Vallish,

The following JCL will give you the desired results for the records which are sorted.

A brief explanation of the Job.

In step0100 We first take the input and copy it into a tempfile with lrecl of 6 and blksize 36.

In step0200, we take the file created in step0100 and contatenate the same file 6 times and we will override the lrecl to 36. By overriding the Lrecl to 36 we are reading 6 records as a single record.And now using outrec fields we are writting only the fields which we want.

Code:

//STEP0100 EXEC PGM=SORT                           
//*                                                 
//SYSOUT    DD SYSOUT=*                             
//SORTIN    DD *                                   
AAAAAA                                             
BBBBBB                                             
CCCCCC                                             
DDDDDD                                             
EEEEEE                                             
FFFFFF                                             
//SORTOUT   DD DSN=TEMPFILE,                   
//             DISP=(NEW,CATLG,DELETE),             
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(X,Y),RLSE),             
//             DCB=(LRECL=6,RECFM=FB,BLKSIZE=36)   
//SYSIN     DD *                                   
  SORT FIELDS=COPY                                   
//*                                                 
//STEP0200 EXEC PGM=SORT                           
//*                                                 
//SYSOUT    DD SYSOUT=*                             
//SORTIN    DD DSN=TEMPFILE,DISP=SHR,LRECL=36   
//          DD DSN=TEMPFILE,DISP=SHR,LRECL=36   
//          DD DSN=TEMPFILE,DISP=SHR,LRECL=36   
//          DD DSN=TEMPFILE,DISP=SHR,LRECL=36   
//          DD DSN=TEMPFILE,DISP=SHR,LRECL=36   
//          DD DSN=TEMPFILE,DISP=SHR,LRECL=36   
//SORTOUT   DD DSN=YOUR FIANL OUTPUT FILE,                   
//             DISP=(NEW,CATLG,DELETE),             
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(X,Y),RLSE)             
//SYSIN     DD *                                   
  SORT FIELDS=COPY                                   
  OUTREC FIELDS=(1,1,8,1,15,1,23,1,30,1,36,1)       
/*                             


The Output from this job is:

Code:

ABCDEF
ABCDEF
ABCDEF
ABCDEF
ABCDEF
ABCDEF


Hope this helps...

cheers

kolusu

ps: I will try to post the solution for un sorted data later.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vallishar
Beginner


Joined: 17 Dec 2002
Posts: 53
Topics: 14
Location: BengaLuru

PostPosted: Thu Mar 13, 2003 9:52 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for the solution.

Regards,
_________________
If you're not failing every now and again, it's a sign you're not doing anything very innovative.
Back to top
View user's profile Send private message Yahoo Messenger
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