TAA Tools
LOCKWAIT        LOCK WAIT                              TAAJOGH

The Lock  Wait  tool provides  commands to  check  for jobs  in a  LCKW
status as  seen with WRKACTJOB.   RUNLCKWAIT provides  job log messages
if  jobs are  waiting for  a lock.   SBMLCKWAIT submits  a never ending
batch job that sends  messages to a message  queue if jobs are  locked.
The  LCKW value can  be caused  by either  a job  waiting for  a record
lock or an object lock.

You  must   have  *JOBCTL  special  authority  to  use  either  of  the
commands.

If a  job is  waiting for  a record  lock, the  message describes  both
jobs (the  job that is  waiting and the job  that holds the  lock), the
library/file/member,  and  relative record  number.   If  an  object is
locked, the message  describes both  jobs, the object  that is  locked,
the type of lock that is held, and the requested lock.

A typical RUNLCKWAIT command would be:

             RUNLCKWAIT

All  jobs in  all subsystems  would  be checked.    Low level  messages
would be sent for any LCKW conditions found.

A typical SBMLCKWAIT command would be:

             SBMLCKWAIT

By default,  the LOCKWAIT job  would be submitted to  the QSYSNOMAX job
queue  and  all jobs  in  all subsystems  would  be checked.   Messages
would be  sent to QSYSOPR  for any  LCKW conditions  found.  After  all
active  jobs were  processed,  the  job would  wait  60 seconds  before
checking all jobs again.

You  may  end the  job  with the  ENDJOB  command or  use  the provided
ENDLCKWAIT command such as:

             ENDLCKWAIT

The default  is to  use  the same  name as  the default  on  SBMLCKWAIT
(LOCKWAIT).

SBMLCKWAIT escape messages you can monitor for
----------------------------------------------

      TAA9891    The named subsystem is not active
      TAA9892    A job named nnn is already active

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

RUNLCKWAIT escape messages you can monitor for
----------------------------------------------

      TAA9891    The named subsystem is not active

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

ENDLCKWAIT escape messages you can monitor for
----------------------------------------------

      TAA9894    The job name is not active
      TAA9895    Multiple jobs exist of the same name

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

SBMLCKWAIT Command parameters                         *CMD
-----------------------------

   SBS           The subsystem  name to be  converted.  The  default is
                 *ALLSBS for  all subsystems.  If  *ALLSBS is used, the
                 library qualifier must be blank.

                 A list of  up to  100 subsystems  may be  entered.   A
                 qualified  library  name  must  be  entered  for  each
                 subsystem name.   The special  value *ALL may  be used
                 to  mean  all  subsystems  in  the  qualified  library
                 name.

   SBMJOBNAM     The name of the job  to be submitted to the  job queue
                 specified  for the  JOBQ  parameter.   The default  is
                 LOCKWAIT.

   DLYTIM        The   number  of   seconds   to  delay   between  each
                 processing cycle.   The default  is 60  seconds.   The
                 value entered must be between 5 and 999 seconds.

                 Each  processing  cycle  begins   with  the  CVTWRKACT
                 command  to convert  the active  jobs  in each  of the
                 named subsystems.   If any  job is in  a LCKW  status,
                 further  processing  occurs  attempting  to  determine
                 the job  that holds the  lock and the  relative record
                 number  if  a  record is  locked.   If  a  PAUSE value
                 greater than  0 is  specified, the  number of  seconds
                 to pause  will occur  for each job  in a  LCKW status.
                 When  all jobs in  a LCKW status  have been processed,
                 the DLYTIM value  is used  to delay processing  before
                 the next cycle of processing begins again.

                 If  a  job  is  in a  LCKW  status  when  the  outfile
                 information from  CVTWRKACT is read, it  may no longer
                 be  locked   during  the   additional  processing   to
                 determine the  job that holds  the lock in  which case
                 the job is bypassed.

   PAUSE         The number  of seconds to pause  before determining if
                 the  job is still in a LCKW  status.  The default is 0
                 meaning  no  pause  occurs  and  a  message   is  sent
                 immediately.   The  value  entered must  be between  0
                 and 60 seconds.

                 If  a  number of  seconds  in entered,  the  batch job
                 waits for  the number  specified and  then  determines
                 if  the job  is still  in a  LCKW  status.   If so,  a
                 message is sent.

                 The  intent of the  PAUSE parameter is  to ensure that
                 a job was not  in a brief  LCKW status before  sending
                 a message.

   MSGQ          The message  queue  to send  messages to  if any  jobs
                 are  in a  LCKW  status.   The default  is  QSYSOPR in
                 QSYS.

                 See  the  documentation  section  on  'Processing  the
                 Messages' for how a  program could be used  to process
                 the messages.

   JOBQ          The  qualified name  of the  job queue  to  submit the
                 batch job to.  QSYSNOMAX in QSYS is the default.

   CMD           This  is a constant  parameter that is  used in common
                 code to tell where the command originated from.


RUNLCKWAIT Command parameters                         *CMD
-----------------------------

   SBS           The subsystem name  to be converted.   The default  is
                 *ALLSBS for all  subsystems.  If *ALLSBS  is used, the
                 library qualifier must be blank.

                 A  list of  up to 100  subsystems may  be entered.   A
                 qualified  library  name  must  be  entered  for  each
                 subsystem name.   The special  value *ALL may  be used
                 to  mean  all  subsystems  in  the  qualified  library
                 name.

   PAUSE         The  number of seconds to  pause before determining if
                 the job is still in  a LCKW status.  The default  is 0
                 meaning  no  pause  occurs   and  a  message  is  sent
                 immediately.    The value  entered must  be  between 0
                 and 60 seconds.

                 If a number of seconds  in entered, the job waits  for
                 the number  specified and  then determines if  the job
                 is  still  in a  LCKW status.    If so,  a  message is
                 sent.

                 The intent of  the PAUSE parameter  is to ensure  that
                 a job was  not in a  brief LCKW status  before sending
                 a message.

   CMD           This is  a constant parameter  that is used  in common
                 code to tell where the command originated from.


ENDLCKWAIT Command parameters                         *CMD
-----------------------------

   JOB           The  name  of the  job submitted  by SBMLCKWAIT.   The
                 default is LOCKWAIT.

Processing the messages
-----------------------

The same  message  IDs  are sent  by  both SBMLCKWAIT  and  RUNLCKWAIT.
RUNLCKWAIT sends messages  to the job log.  The  low level messages may
be  seen in an interactive job by  using the full command entry display
and F10.  If not on the full command entry display CALL QCMD.

The  default for  SBMLCKWAIT  is  to  send  messages  to  QSYSOPR.    A
specific message queue may also be named.

The named  message queue  could be set  to *BREAK  mode with  a program
named  to process  the messages.   To  write a  program to  process the
messages you will  need to do  a RCVMSG  and use the  MSGID and  MSGDTA
parameters.   The MSGDTA used  is a data  structure that is  unique for
each  of  the  message IDs  sent.    Three  different  message IDs  may
appear:

  **   TAA1041  is used for a record lock  wait.  The message data will
       contain the following:

      1 - 6    Job number of the waiting job
      7 - 16   User of the waiting job
     17 - 26   Job name of waiting job
     27 - 37   Relative record number of the locked record
     38 - 47   Member of the file
     48 - 57   File name
     58 - 67   File library name
     68 - 73   Job number of the job that holds the lock
     74 - 83   User of the job that holds the lock
     84 - 93   Job name of the job that holds the lock
     94 - 103  The TAA command that sent the message

  **   TAA1042 is  used for  a lock  wait  on a  non-data base  object.
       The message data will contain the following:

      1 - 6    Job number of the waiting job
      7 - 16   User of the waiting job
     17 - 26   Job name of waiting job
     27 - 36   The object that is locked
     37 - 46   The object library
     46 - 53   The object type
     54 - 63   The lock type requested
     64 - 69   Job number of the job that holds the lock
     70 - 79   User of the job that holds the lock
     80 - 89   Job name of he job that holds the lock
     90 - 99   The lock type that is held
    100 - 109  The TAA command that sent the message

  **   TAA1043  is used for  a lock  wait on  a data  base file  (not a
       record lock).  The message data will contain the following:

      1 - 6    Job number of the waiting job
      7 - 16   User of the waiting job
     17 - 26   Job name of waiting job
     27 - 36   The file that is locked
     37 - 46   The file library
     46 - 53   The file type
     54 - 63   The lock type requested
     64 - 69   Job number of the job that holds the lock
     70 - 79   User of the job that holds the lock
     80 - 89   Job name of he job that holds the lock
     90 - 99   The lock type that is held
    100 - 109  The member of the file that is locked
    110 - 119  The TAA command that sent the message

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

You must have *JOBCTL special authority to use either command.

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

The following TAA Tools must be on your system:

     CHKACTJOB       Check active job
     CHKJOBCTL       Check job control
     CHKOBJ3         Check object 3
     CVTJOBLCK2      Convert job lock 2
     CVTOBJLCK       Check object lock
     CVTRCDLCK2      Convert record lock 2
     CVTWRKACT       Convert work active
     EDTVAR          Edit variable
     LOOKUP          Lookup
     RSNALLMSG       Resend all messages
     RSNLSTMSG       Resend last message
     RTVACTSBS       Retrieve active subsystems
     RTVJOBA2        Retrieve job attributes 2
     RTVJOBSTS       Retrieve job status
     SNDCOMPMSG      Send completion message
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message
     SNDSTSMSG       Send status message
     SORTDBF         Sort data base file

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

None, the tool is ready to use.

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

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

   SBMLCKWAIT    *CMD                   TAAJOGH       QATTCMD
   RUNLCKWAIT    *CMD                   TAAJOGH2      QATTCMD
   ENDLCKWAIT    *CMD                   TAAJOGH3      QATTCMD
   TAAJOGHC      *PGM       CLP         TAAJOGHC      QATTCL
   TAAJOGHC2     *PGM       CLP         TAAJOGHC2     QATTCL
   TAAJOGHC3     *PGM       CLP         TAAJOGHC3     QATTCL
   TAAJOGHC11    *PGM       CLP         TAAJOGHC11    QATTCL
   TAAJOGHC12    *PGM       CLP         TAAJOGHC12    QATTCL
   TAAJOGHC13    *PGM       CLP         TAAJOGHC13    QATTCL
   TAAJOGHC14    *PGM       CLP         TAAJOGHC14    QATTCL
   TAAJOGHC17    *PGM       CLP         TAAJOGHC17    QATTCL
   TAAJOGHC18    *PGM       CLP         TAAJOGHC18    QATTCL

Structure
---------

SBMLCKWAIT  Cmd
   TAAJOGHC   CL pgm  Submits TAAJOGHC11
     TAAJOGHC11 CL Pgm         Main program - Does CVTWRKACT
       TAAJOGHC12 CL Pgm       Uses CVTRCDLCK2 to chk record locks
                                 of the job that is waiting
       TAAJOGHC13 CL Pgm       Uses CVTOBJLCK to determine object
          TAAJOGHC14 CL Pgm    Uses CVTRCDLCK2 for who has lock
       TAAJOGHC17 CL Pgm       Uses CVTJOBLCK2 to determine object
         TAAJOGHC18 CL Pgm     Uses CVTOBJLCK for who has the lock

RUNLCKWAIT  Cmd
   TAAJOGHC2   CL pgm   - Does call to TAAJOGHC11 as above

ENDLCKWAIT  Cmd
   TAAJOGHC3   CL pgm
					

Added to TAA Productivity tools January 15, 2014


Home Page Up to Top