On first reading I thought this would be a pretty simple thing to
dig up. Not quite!
Under ISPF you can get a panel to display who is holding a dataset
by typing the following on the command line:
TSO ISRDDN ENQ Dataset-name
The ISRDDN command is documented at:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr/FRAMESET/ispzug50/G.0?ACTION=MATCHES&REQUEST=isrddn&TYPE=FUZZY&SHELF=ispzpm50&DT=20060621022939
Invoking ISRDDN is possible from within a REXX program but I don t
know how to capture the output into a stem variable where you could
parse it out and issue a message. I could not find a command line
interface to ISRDDN that allows capture of the output.
There is another utiltiy at:
http://www.sillysot.com/mvs/index.htm?queryenq.htm
that claims to do this as well, I have never tried it so cannot
comment any further on it.
I Googled your question and it looks like several people have used
the MVS command
D GRS,RES=(*,dsname)
to determine who is holding
a dataset. However, this requires console access so would not be
appropriate for most users. If console access is allowed, then you could start a console
session under REXX and capture the output fairly easily, see:
http://www.redbooks.ibm.com/redbooks/pdfs/sg244626.pdf.
One final place to search would be the CBT tapes (freeware for
IBM mainframes). Here you can find several implementations of the WHOHAS
ISPF command.
Sorry, but this is the best I can do.