Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to reverse the contents of file?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Jun 17, 2008 3:22 pm    Post subject: How to reverse the contents of file?
Reply with quote

I have 5 records in a PS file. How can we write it in a file in the reverse order using SORT.

Sample Input File :

KEVIN 
SMITH 
JAMES 
JONE  
ANTONY

Expected Output File :

ANTONY    
JONE      
JAMES     
SMITH     
KEVIN   

Input file need not be in sorted order. But we have to reverse the contents.

Regards
R KARTHIK
Back to top
View user's profile Send private message

karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Jun 17, 2008 4:04 pm    Post subject: Reply to: How to reverse the contents of file?
Reply with quote

Hi,

I got the code from previous forums.

Code:

//S1    EXEC  PGM=ICEMAN                     
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD DSN=...  input file (FB/80)                               
//SORTOUT DD DSN=...  output file (FB/80)                       
//SYSIN    DD    *                           
* Add seqnum.
  INREC OVERLAY=(81:SEQNUM,8,ZD)             
* Sort on seqnum descending.
  SORT FIELDS=(81,8,ZD,D)   
* Remove seqnum.                 
  OUTREC BUILD=(1,80)                         
/*
Back to top
View user's profile Send private message
Vasukip
Currently Banned

New User


Joined: 17 Jun 2008
Posts: 48
Location: Chennai

PostPosted: Wed Jun 18, 2008 2:30 pm    Post subject: Re: Reply to: How to reverse the contents of file?
Reply with quote

Hi Can you explain this code icon_exclaim.gif ? you said the Input file is not in sorted order ,without sorting do we have to reverse the data ?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Jun 18, 2008 2:58 pm    Post subject: Reply to: How to reverse the contents of file?
Reply with quote

vasu,

Quote:
Hi Can you explain this code


INREC OVERLAY=(81:SEQNUM,8,ZD) - 8 byte sequence no is overlaid in the 81st column. so first record wud have 00000001, second record 00000002, third record 00000003 and so on

SORT FIELDS=(81,8,ZD,D) - then sorting is done based on the sequence no (descending order)

OUTREC BUILD=(1,80) - seq no's are removed

comments are there in the code.

Quote:
you said the Input file is not in sorted order ,without sorting do we have to reverse the data ?


data is not reversed the order of the records is reversed.
Back to top
View user's profile Send private message
Vasukip
Currently Banned

New User


Joined: 17 Jun 2008
Posts: 48
Location: Chennai

PostPosted: Wed Jun 18, 2008 3:03 pm    Post subject: Re: Reply to: How to reverse the contents of file?
Reply with quote

Hello Six,

Thank you so much for ur gr8 expalnation ! I'm a novice Mainframe- Developer icon_lol.gif .
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Jun 18, 2008 3:33 pm    Post subject: Reply to: How to reverse the contents of file?
Reply with quote

Vasu,

Not a problem and you are welcome.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us