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: 992
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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