View previous topic :: View next topic
|
Author |
Message |
rakesh1155
New User
Joined: 21 Jan 2009 Posts: 84 Location: India
|
|
|
|
I want to copy only the last but one record to another output file
Can someone tell me how can I achieve this ? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Last but one record from where
PS file, VSAM file, DB2 table, ISPF table, tape, DASD, anything else.
Any particular utility / program you have in mind to use. |
|
Back to top |
|
|
rakesh1155
New User
Joined: 21 Jan 2009 Posts: 84 Location: India
|
|
|
|
Sorry for incomplete information
Input file - PS, LRECL=80, RECFM=FB
Output file - PS, LRECL=80, RECFM=FB
The output file should contain only the last but one record from the input file
For example, the input file contains 10 records, Output file should contain only the 9th record
OR
if the input file contains 20 records, output file should contain only the 19th record. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Here is one way to accomplish this task:
Code: |
//SYSIN DD *
INREC OVERLAY=(81:SEQNUM,4,ZD)
SORT FIELDS=(81,4,CH,D)
OUTREC OVERLAY=(81:SEQNUM,4,ZD)
OUTFIL INCLUDE=(81,4,ZD,EQ,2),BUILD=(1,80)
/* |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Alissa,
is there a syncsort ability
to OUTFIL from the sorted data
STARTAFTER 1, STOPAFTER 2?
then you would not need the second sequencing. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Absolutely. Here is the syntax:
Code: |
//SYSIN DD *
INREC OVERLAY=(81:SEQNUM,4,ZD)
SORT FIELDS=(81,4,CH,D)
OUTFIL STARTREC=2,ENDREC=2,BUILD=(1,80)
/* |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Thx Alissa |
|
Back to top |
|
|
|