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
 
How to read last record in VSAM file in batch processing?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
umed

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Fri Sep 01, 2006 12:05 am    Post subject: How to read last record in VSAM file in batch processing?
Reply with quote

Hi,

Please let me know How to read last record in VSAM file in batch processing?

Regards,
Umed
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Sep 01, 2006 1:10 am    Post subject:
Reply with quote

Sort it backwards and REPRO to SYSOUT with COUNT(1).

O.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 01, 2006 2:23 am    Post subject:
Reply with quote

Quote:
Sort it backwards and REPRO to SYSOUT with COUNT(1).


You don't need two passes (SORT and REPRO). You can do it all in one pass with a DFSORT job like this:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VSAM)
//SORTOUT DD DSN=... output file (VSAM or VB)
//SYSIN DD *
* Add sequence numbers. Use them to reverse the order of
* the records.
  RECORD TYPE=V
  INREC FIELDS=(1,4,5:SEQNUM,8,ZD,13:5)
  SORT FIELDS=(5,8,ZD,D)
* Get the last record.  Remove the sequence number.
  OUTFIL ENDREC=1,OUTREC=(1,4,13)
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Sep 18, 2008 2:26 am    Post subject:
Reply with quote

You can now do this more easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//S1  EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                           
//DFSMSG    DD  SYSOUT=*                                           
//IN DD DSN=...  input file (VSAM)                                     
//OUT DD DSN=...  output file (VSAM or VB)       
//TOOLIN DD *                                                     
SUBSET FROM(IN) TO(OUT) KEEP INPUT TRAILER VSAMTYPE(V)
/*     


For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm

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