Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reversing the file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
harijax

New User


Joined: 16 Jul 2008
Posts: 22
Location: Bangalore

PostPosted: Thu Apr 09, 2009 12:01 pm    Post subject: Reversing the file
Reply with quote

Hi,

I have an unsorted flat file which cannot be sorted. Unfortunately the first data I require from the file is in the very last record. So now I have to read the entire file and get this data and start reading the file from the start.

Is it possible to get tis data to the tool through some SYNCSORT step.

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

Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 994
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Apr 09, 2009 2:13 pm    Post subject:
Reply with quote

You could use use SYNCSORT to append or prepend SEQNUM to work records and then sort these descending to reverse the order of the records in a workfile, removing the SEQNUM. The original file is unaffected.

I'm sure there are alternative ways to skin this particular cat.

Garry.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Apr 10, 2009 4:55 am    Post subject:
Reply with quote

If your shop has FileAid you can try this:
Code:
//COPYBACK EXEC PGM=FILEAID
//DD01     DD  DSN=YOUR.FILE,etc.
//DD01O    DD  DSN=last.rec.file,etc.
//SYSIN    DD  *
$$DD01 COPYBACK OUT=1
/*
//*
//NEXT    EXEC PGM=....
//LASTREC DD DSN=last.rec.file,etc.
//etc....
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Apr 10, 2009 2:12 pm    Post subject:
Reply with quote

Hi,

If you have DFSORT and the correct PTF, try this:
Code:
//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT LAST
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Apr 10, 2009 2:14 pm    Post subject:
Reply with quote

or may be this:
Code:
//SYSIN    DD *                           
  SORT FIELDS=COPY                       
  OUTFIL REMOVECC,NODETAIL,TRAILER1=(1,80)
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us