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 

Reverse the order of records

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


Joined: 03 Oct 2003
Posts: 11
Topics: 4

PostPosted: Fri Oct 03, 2003 12:20 pm    Post subject: Reverse the order of records Reply with quote

we have a GDG (may be unsorted) of 80 as LRECL and FB as the record format. We need to reverse the position of the records i.e. if the file has 5 records, the 5th record will come in the 1st position,4th in 2nd and so on. The sequence needs to be same as in the input but in a reverse order.

So if the input file has records such as :-
123456
234567
980001
345678
218976

The output file should look like :-
218976
345678
980001
234567
123456

Can we achieve this using DFSORT/ICETOOL. I know we can do this using REXX.
Thank you.
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: Fri Oct 03, 2003 12:53 pm    Post subject: Reply with quote

The following DFSORT/ICETOOL job will do what you want:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&O1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
  COPY FROM(IN) TO(T1) USING(CTL1)
  SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
* Add sequence numbers to end of record
  OUTREC FIELDS=(1,80,81:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
* Sort descending on sequence number
* to get reverse order
  SORT FIELDS=(81,8,ZD,D)
* Remove sequence numbers
  OUTREC FIELDS=(1,80)
/*

_________________
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
help_me
Beginner


Joined: 03 Oct 2003
Posts: 11
Topics: 4

PostPosted: Fri Oct 03, 2003 1:11 pm    Post subject: Reply with quote

Thank you.
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: Sat Oct 04, 2003 8:15 am    Post subject: Reply with quote

help_me,

If you have FILE-AID at your shop then the following JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=FILEAID                 
//DD01     DD DSN=YOUR.INPUT.FILE,
//            DISP=SHR
//DD01O    DD DSN=YOUR.OUTPUT.FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE),
//            DCB=(LRECL=NNN,RECFM=FB,BLKSIZE=0)
//SYSIN    DD *                             
$$DD01 COPYBACK                             
/*   


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Sat Oct 04, 2003 11:48 pm    Post subject: Reply with quote

REXX solution:
Code:
/* REXX */                                                       
                                                                 
ADDRESS TSO "ALLOC FI(TEMP) DA('your.data.set') SHR"
            "EXECIO * DISKR TEMP (LIFO FINIS"                     
                                                                 
            DO I = 1 TO QUEUED()                                 
              PULL LINE.I
            END                                                   
                                                                 
            "EXECIO * DISKW TEMP (STEM LINE. FINIS"               
            "FREE FI(TEMP)"                                       
                                                                 
EXIT                                                             
                                                                 


O.
________
Ford Motor Company Philippines picture
Back to top
View user's profile Send private message Send e-mail
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