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 

How to copy records from backword using sort

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


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Wed Jan 21, 2009 8:44 am    Post subject: How to copy records from backword using sort Reply with quote

Hi All,

Please tell me how to copy records from backword using sort utility

Thanks
Siva
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 21, 2009 11:05 am    Post subject: Reply with quote

Siva,

If you mean you want to copy the records in reverse order, you can use a DFSORT job like the following to do that. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN                     
//SYSOUT   DD  SYSOUT=*                     
//SORTIN DD *                               
RECORD 01                                   
RECORD 02                                   
RECORD 03                                   
RECORD 04                                   
RECORD 05                               
/*     
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                           
  INREC OVERLAY=(81:SEQNUM,8,ZD)             
  SORT FIELDS=(81,8,ZD,D)                   
  OUTREC BUILD=(1,80)                       
/*


SORTOUT would have:

Code:

RECORD 05   
RECORD 04   
RECORD 03   
RECORD 02   
RECORD 01   


If that's not what you want, then please explain more clearly what you do want with an example of your input records and expected output records.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sivafdms
Intermediate


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Wed Jan 21, 2009 12:25 pm    Post subject: Reply with quote

Hi Frank,

The job worked perfectly fine. But i am not able to understand how it copies the data in reverse order.

Thanks,
Siva
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: Wed Jan 21, 2009 1:13 pm    Post subject: Reply with quote

sivafdms wrote:
Hi Frank,

The job worked perfectly fine. But i am not able to understand how it copies the data in reverse order.

Thanks,
Siva


It is quite simple siva. Using INREC statement we add a record number at the end of each record ie at pos 81 which looks like this

Code:


---+----1----+----2----+----pos81-88

RECORD 01                    00000001
RECORD 02                    00000002
RECORD 03                    00000003
RECORD 04                    00000004
RECORD 05                    00000005


Now we are sorting on the newly added record number field in DESCENDING order and using outrec we remove the newly added field which gives you the results backwards.

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


Joined: 29 May 2007
Posts: 165
Topics: 77

PostPosted: Thu Jan 22, 2009 8:25 am    Post subject: Reply with quote

Thanks Frank and Kolusu
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