Page 1 of 1

ISPF table leaves an ENQ outstanding.

PostPosted: Fri Nov 02, 2012 4:16 pm
by Richard Eden
I have a REXX procedure which updates an ISPF table. It allocates the table library and opens the table like this:

address TSO
"allocate dataset('"||tabllib||"') file(SH4TLIB) reuse shr"
address ISPEXEC "tbopen "tb_name" write library(SH4TLIB) share"

At the end of the procedure it closes the table and frees the library like this:

address ISPEXEC "tbclose "tb_name" library(SH4TLIB)"
address ISPEXEC "tbopen junk library(ddjunk)"
address TSO
"free f(SH4TLIB)"

The procedure all works fine, but it leaves an outstanding EXCL OWNER ENQ on the table library. Any ideas on how I can delete this ENQ?

Thanks for any help and advice.
Richard.

Re: ISPF table leaves an ENQ outstanding.

PostPosted: Fri Nov 02, 2012 4:47 pm
by Akatsukami
Why do you allocate the library with ALLOC rather than LIBDEF?

Re: ISPF table leaves an ENQ outstanding.

PostPosted: Fri Nov 02, 2012 5:16 pm
by Richard Eden
Thanks for the response.

I tried allocating the library and opening the table like this:

address TSO
"allocate dataset('"||tabllib||"') file(SH4TLIB) reuse shr"
address ISPEXEC "libdef ISPTLIB dataset ID('"||tabllib||"')"
address ISPEXEC "tbopen "tb_name" write library(SH4TLIB) share"

And closing it like this:

address ISPEXEC "tbclose "tb_name" library(SH4TLIB)"
address ISPEXEC "tbopen junk library(ddjunk)"
address ISPEXEC "libdef ISPTLIB"
address TSO
"free f(SH4TLIB)"

but it made no difference. I still have the outstanding ENQ.

Re: ISPF table leaves an ENQ outstanding.

PostPosted: Fri Nov 02, 2012 6:57 pm
by Akatsukami
You shouldn't need to use ALLOC and FREE. I'm just settling down in my office at the moment, so it'll be 15 minutes or so until I can test, but try:
address ispexec "LIBDEF SH4TLIB DATASET ID('"tablib"')"
address ispexec "TBOPEN "tb_name" WRITE LIBRARY(SH4TLIB)"
(other stuff)
address ispexec "TBCLOSE "tb_name" LIBRARY(SH4TLIB)"
address ispexec "LIBDEF SH4TLIB"

Re: ISPF table leaves an ENQ outstanding.

PostPosted: Fri Nov 02, 2012 10:58 pm
by Pedro
address ISPEXEC "tbopen junk library(ddjunk)"

Somehow, this seem unnecessary.

Re: ISPF table leaves an ENQ outstanding.

PostPosted: Tue Nov 06, 2012 4:38 pm
by Richard Eden
The address ISPEXEC "tbopen junk library(ddjunk)" statement is necessary because:

If the LIBRARY parameter is used with a table service, the user is not able to free
the ddname for the table library pointed to by the LIBRARY parameter.
ISPF keeps this library open until a new ddname is used in the LIBRARY
parameter with another table service. ISPF functions in this manner
for performance reasons.

Issuing a table service with a LIBRARY parameter containing a ddname that does not exist causes the previous
library to be closed and therefore allows the user to free the previous
ddname. Use of CONTROL ERRORS RETURN may be used to guard against
a severe error as a result of a ddname not existing.

I changed my code to use LIBDEF instead of ALLOC as you suggested, and this seems to work all right - I no longer have outstanding ENQs.

Thanks for your help.
Richard.