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

Syncsort COPY LAST BUT ONE RECORD


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Wed Aug 18, 2010 4:34 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Aug 18, 2010 4:52 pm
Reply with quote

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
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Wed Aug 18, 2010 5:00 pm
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Wed Aug 18, 2010 11:20 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 18, 2010 11:48 pm
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Aug 19, 2010 12:03 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 19, 2010 12:27 am
Reply with quote

Thx Alissa
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top