TAA Tools
RTVLCKEXCL      RETRIEVE LOCK EXCLUSIVE                TAAOBMT

The Retrieve  Lock Exclusive  command allows  you to  determine if  any
job has  an *EXCL lock  on an object.   Certain display  functions such
as  DSPOBJAUT will fail  if a *DTAARA  object is locked  by a different
job to  *EXCL.  DSPPFM  will fail  if a member  is locked  exclusively.
The API QWCLOGJL is used.

A typical series of commands would be:

             DCL        &JOB *CHAR LEN(10)
              .
             RTVLCKEXCL OBJ(ABC/XXX) OBJTYPE(*DTAARA)
                          JOB(&JOB)
             IF         ((%SST(&JOB 1 1) *NE '*') DO /* Not spcl */
                        /*                                       */
                        /*   Your handling of a different job    */
                        /*     has an *EXCL lock on the XXX      */
                        /*     data area in library ABC.         */
                        /*                                       */
             ENDDO      /* Not spcl */
             IF         ((%SST(&JOB 1 1) *EQ '*') DO /* Special  */
                        /*                                       */
                        /*   Your handling of no job (other      */
                        /*     than possibly your own) has an    */
                        /*     *EXCL lock on the XXX data area   */
                        /*     in library ABC                    */
                        /*                                       */
             ENDDO      /* Special */


When  RTVLCKEXCL runs,  it  accesses any  locks  that are  held on  the
specified  object.   If  an *EXCL  lock is  not  found, the  JOB return
variable will contain *NONE.  If  the current job holds an *EXCL  lock,
the  JOB  return  variable  will contain  *CURRENT  (this  is  why  the
typical coding shown checks for a special value).

Multiple locks
--------------

It  is possible for  a single  job to hold  multiple locks on  the same
object such as  *SHRRD and *EXCL  or multiple *EXCL locks.   In  either
case, RTVLCKEXCL would  return the job  name because it holds  at least
one *EXCL lock.

Only one job can hold an *EXCL lock on an object.

Data base locks
---------------

When ALCOBJ is used on a data base file such as:

             ALCOBJ     OBJ(ABC/XXX *FILE *EXCL)

A *SHRRD  lock is placed  on the file  object.  Even  though the member
is  not specified, there would  be an *EXCL lock placed  on the data of
the first member.  It operates the same as if you had specified:

             ALCOBJ     OBJ(ABC/XXX *FILE *EXCL *FIRST)

Functions such as DSPOBJAUT may  be used by any job on the  file object
because  they operate  at  the file  level  and not  the member  level.
Functions  such as DSPPFM cannot be used  by another job because of the
member lock.

There is  no method of  locking a  data base  file object  to an  *EXCL
level using ALCOBJ.

System locking for various functions
------------------------------------

The system  places a lock on  an object when  a change is made  such as
CHGDTAARA.   These  locks are normally  held only  for the  duration of
the command and do not interfere with most other functions.

The ALCOBJ command  does not  have all  the function  that the  locking
functions provided by the  system.  For example, you  cannot allocate a
printer file type, but the system does for certain functions.

RTVLCKEXCL escape messages you can monitor for
----------------------------------------------

None.  Escape messages from based on functions will be re-sent.

RTVLCKEXCL Command parameters                         *CMD
-----------------------------

   OBJ           The  qualified name  of  the object  to  retrieve lock
                 information for.

The  library value  defaults to *LIBL.   A specific  library or *CURLIB
may also be used.

   OBJTYPE       The object  type  to  retrieve lock  information  for.
                 Use the prompter for the supported values.

   MBR           The member  name.  The  default is *NONE.   A specific
                 member name or *FIRST may be entered.

If *NONE  is specified for a data base file,  the check is done for the
file object and not any of the members.

   JOB           The return variable  for the job  name which holds  an
                 *EXCL lock.   A variable name is required  and must be
                 specified as *CHAR LEN(10).

                 If no job holds an *EXCL lock, *NONE is returned.

                 If  the current job  holds an *EXCL  lock, *CURRENT is
                 returned.

   USER          The optional  return variable  for  the user  name  of
                 the job  which  holds an  *EXCL lock.    If used,  the
                 variable must must be specified as *CHAR LEN(10).

   JOBNBR        The  optional return  variable for  the job  number of
                 the  job  which holds  an *EXCL  lock.   If  used, the
                 variable must must be specified as *CHAR LEN(6).

   QLFJOB        The optional  return  variable for  the qualified  job
                 name  which has  *EXCL lock.   This  may be  useful if
                 needed  in  a message.    If used,  the  variable must
                 must be specified as *CHAR LEN(28).


Restrictions
------------

Because RTVLCKEXCL returns variables, the  command may only be used  in
a CL type of program.

Prerequisites
-------------

The following TAA Tools must be on your system:

     CHKOBJ3         Check object 3
     CRTUSRSPC       Create user space
     RSNLSTMSG       Resend last message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message

Implementation
--------------

None, the tool is ready to use.

Objects used by the tool
------------------------

   Object        Type    Attribute      Src member    Src file
   ------        ----    ---------      ----------    ----------

   RTVLCKEXCL    *CMD                   TAAOBMT       QATTCMD
   TAAOBMTC      *PGM       CLP         TAAOBMTC      QATTCL
   TAAOBMTR      *PGM       RPG         TAAOBMTR      QATTRPG
					

Added to TAA Productivity tools October 15, 2012


Home Page Up to Top