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: 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: 6968
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: 6968
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm

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