Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
umed

New User


Joined: 13 May 2005
Posts: 40

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
References
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 1959
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: 4613
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: 4613
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1