IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reversing the file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Apr 09, 2009 2:13 pm
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
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

Superior Member


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

PostPosted: Fri Apr 10, 2009 2:12 pm
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

Superior Member


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

PostPosted: Fri Apr 10, 2009 2:14 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top