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
 

 

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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
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 Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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