Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8614
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: 6970
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: 6970
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 query to fetch record which has only ... maxsubrat DB2 0 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us