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: 991
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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