> -----Original Message-----
> From: IBM Mainframe Discussion List 
> [mailto:[EMAIL PROTECTED] On Behalf Of Paul 
> [EMAIL PROTECTED]
> Sent: Friday, July 20, 2007 9:14 AM
> To: [email protected]
> Subject: Last Record
> 
> 
> There's a thread active in TSO-REXX in which the OP wished
> to extract the last record from a data set.  Of course, this
> spawns a school of increasingly byzantine suggestions:
> 
>     Read into a stem and use the STEM.0th element
> 
>     Edit Macro
> 
>     Sort into reverse order and take the first.
> 
>     Count the legs and divde by four
> 
> (I suggested:
> 
>     cp "//'DATA.SET.NAME(MEMBER)'" /dev/fd/1 | tail -1
> 
> ... )
> 
> But usually to such questions, Frank chimes in saying
> it's a natural for DFSORT.  Is it?
> 
> -- gil

Sounds reasonable to me. SORT has some of the best I/O routines around.

Outside of that, if this were to be done often, then I'd write my own
program. In HLASM, assuming a sequential file, I'd look at the DS1LSTAR
(and DS1TRBAL if the DS is extended format). I would then use BSAM and
POINT myself at record 1 of either the last track or next-to-last track
and read forward from there until EOF. This does not apply to any other
dataset type.

--
John McKown
Senior Systems Programmer
HealthMarkets
Keeping the Promise of Affordable Coverage
Administrative Services Group
Information Technology

The information contained in this e-mail message may be privileged
and/or confidential.  It is for intended addressee(s) only.  If you are
not the intended recipient, you are hereby notified that any disclosure,
reproduction, distribution or other use of this communication is
strictly prohibited and could, in certain circumstances, be a criminal
offense.  If you have received this e-mail in error, please notify the
sender by reply and delete this message without copying or disclosing
it.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to