tpf_enqc_query: Query ECB shared resource

This function determines whether a shared resource that was defined by using the enqc function is being held by the current ECB.

Last updated

Added in 2020.

Format

#include  <tpf/tpfapi.h>
int       tpf_enqc_query(char *enq_name,enum e_qual ss_qual);
enq_name
The pointer to an 8-byte area that contains the shared resource name that you want to query.
ss_qual
Subsystem qualification for the resource. The argument must belong to the enumerated type e_qual, which is defined in the tpfapi.h header file. Use one of the following predefined terms:
QUAL_U
Specifies that subsystem qualification is applied. If this value is specified, the resource name is subsystem unique and is qualified by the database index (DBI) value for the subsystem.
QUAL_S
Specifies that system-wide qualification is applied. If this value is specified, the resource name is not subsystem unique.

Any ECB that issues the enqc function with QUAL_S value specified is enqueued on the same named resource. If two enqc functions are issued with the same resource name but different ss_qual values, two different resource names are assumed to exist.

Normal return

One of the following values are returned:
TPF_ENQC_QUERY_NOT_FOUND
Indicates that the shared resource is not in use.
TPF_ENQC_QUERY_HELD
Indicates that the shared resource is being held by the current ECB.
TPF_ENQC_QUERY_OTHER_ECB
Indicates that the shared resource is being held by an ECB other than the current ECB.

Error return

None.

Programming considerations

None.

Examples

The following example queries a shared resource to see whether it is being held by the current ECB.
if (tpf_enqc_query (“TESTRSC1”,QUAL_S) == TPF_ENQC_QUERY_HELD)
   {
       deqc(“TESTRSC1”,QUAL_S);
        exit(0);
    }