|
|
| Author |
Message |
umed
New User
Joined: 13 May 2005 Posts: 40
|
|
|
|
Hi,
Please let me know How to read last record in VSAM file in batch processing?
Regards,
Umed |
|
| Back to top |
|
 |
References
|
|
 |
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 1959 Location: Israel
|
|
|
|
Sort it backwards and REPRO to SYSOUT with COUNT(1).
O. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
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 |
|
 |
|
|