View previous topic :: View next topic
|
Author |
Message |
harijax
New User
Joined: 16 Jul 2008 Posts: 22 Location: Bangalore
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
or may be this:
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,TRAILER1=(1,80) |
|
|
Back to top |
|
|
|