TAA Tools

The Retrieve Submitted  Command command retrieves the command  that was
submitted by  a SBMJOB.  The job  may be on a job  queue, be active, or
have  completed as long as DSPJOBLOG can be  used.  The command for the
first  'Request'  type  message  is  returned.    Several  restrictions

A typical series of commands would be:

             DCL        &CMD *CHAR LEN(512)
             RTVSBMCMD  JOB(jobnbr/user/job) CMD(&CMD)

Assuming  the job  had not  completed, the  DSPJOBLOG command  would be
run  for the named  job.   The job log  would be copied  to a temporary
file in  QTEMP.    If the  job  has  completed and  the  QPJOBLOG  file
exists, the job log is copied to the temporary file.

The temporary  file is read  and the  command identified for  the first
'Request' type message would be returned.

                 Another  example is  when a  job  submits a  batch job
                 and wants a variable  containing the command that  was

             DCL        &JOB *CHAR LEN(10)
             DCL        &USER *CHAR LEN(10)
             DCL        &JOBNBR *CHAR LEN(6)
             DCL        &RTVCMD *CHAR LEN(512)
             SBMJOB     JOB(xxx) CMD(....)

After the  SBMJOB, the code  retrieves the specifics  of the batch  job
and then uses RTVSBMCMD to retrieve the submitted command.


  **   A specific  qualified job name must be entered  for a batch job.

  **   The  job must have  been entered using SBMJOB  or a job schedule

  **   Only  a  lower  or  upper  case  English  language  job  log  is
       supported when processing the job log.

  **   The  command associated  with the  first 'Request'  type message
       is returned.

  **   The  command does not  distinguish between  the SBMJOB parameter
       values of CMD or  RQSDTA.  If RQSDTA  is entered, it is  assumed
       to be a command.

  **   Up to 6 lines of command data from the job log may exist.

  **   Because RTVSBMCMD  returns a variable,  the command may  only be
       used in a CL program.

RTVSBMCMD escape messages you can monitor for

      TAA9891    More than 6 lines of command data exist
      TAA9892    No 'Request' type message was found
      TAA9893    The job could not be found in the system
      TAA9894    The job is not batch job

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

RTVSBMCMD Command parameters                          *CMD

   JOB           The  qualified job name  of the batch  job to retrieve
                 the command for that was used on SBMJOB.

                 * may be specified to  retrieve from the current  job.
                 This can only  be specified in  a batch job  and would
                 make sense  if the job wanted to  retrieve the command
                 that it began with.

   CMD           The  command to be  returned.  It  must be declared as
                 *CHAR LEN(512).


See previous list.


The following TAA Tools must be on your system:

     RSNLSTMSG       Resend last message
     RTVJOBA2        Retrieve Job Attributes 2
     SNDESCINF       Send escape information
     SNDESCMSG       Send escape message


None, the tool is ready to use.

Objects used by the tool

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

   RTVSBMCMD     *CMD                   TAAJOFR       QATTCMD
   TAAJOFRC      *PGM       CLP         TAAJOFRC      QATTCL

Added to TAA Productivity tools July 15, 2011

Home Page Up to Top