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
 

 

Syncsort COPY LAST BUT ONE RECORD

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort COPY LAST BUT ONE RECORD
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: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 18, 2010 4:52 pm    Post subject:
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    Post subject: Reply to: COPY LAST BUT ONE RECORD
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: 500
Location: USA

PostPosted: Wed Aug 18, 2010 11:20 pm    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Wed Aug 18, 2010 11:48 pm    Post subject:
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: 500
Location: USA

PostPosted: Thu Aug 19, 2010 12:03 am    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Thu Aug 19, 2010 12:27 am    Post subject:
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    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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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