RTV Latest Job

401 Views


Retrieve latest ran as400 job user name and job number using below commands

RTVJOBSTS - RETRIEVE JOB STATUS

 

The  Retrieve Job  Status command  allows  you to  return  a status  of whether  a job  is on  the job  queue, is  active or  is on  the output queue.   A fully qualified job name or  a less than fully qualified job name may be  entered.   A generic job  or user name  may also be  used. You may request a status (*ALL *JOBQ *ACTIVE *OUTQ)

If  a  less  than fully  qualified  job  name  is  used, there  may  be duplicates.    Return values  occur for  the first  or  last job  and a
count of  the number  of jobs.   Informational  messages  are sent  for each duplicate.   The definition of 'first' or 'last'  is determined by
the DUPJOBRQS parameter.

An internal  work space is used which will hold  a maximum of 546 jobs.
Only  the  jobs  in  the  internal  work  space  are  considered when determining how the options on DUPJOBRQS will be handled.

  **   *FIRST  causes  the  job  with  the  lowest  job  number  to  be returned.  If the job numbers wrap, it may not be the first.

  **   *FIRSTDATE  causes the  job  with the  earliest  date/time value for when the job entered the system to be returned.

  **   *LAST  causes  the  job  with  the  highest  job  number  to  be returned.

  **   *LASTDATE causes  the job  with the latest  date/time value  for when the job entered the system to be returned.

A  typical command  to determine  the status  of a  qualified  job name would be:

      RTVJOBSTS    JOB(123456/QPGMR/PAYROLL) RTNSTS(&RTNSTS)
      IF           (&RTNSTS *EQ '*ACTIVE') DO ...

Another  typical use is where  you want to know  the qualified job name of the  job named  PAYROLL.   In the  following  command, &RTNUSER  and &RTNJOBNBR would contain the rest of the fully qualified job name.

      RTVJOBSTS    JOB(PAYROLL) STATUS(*ACTIVE) RTNUSER(&RTNUSER)
                     RTNJOBNBR(&RTNJOBNBR)

If a  simple job  name is  used, there  may be  duplicates.  Assume  if there  is only one job  active of the  simple name (e.g.   your current job), you want to do some set of code:

      RTVJOBSTS    JOB(PAYROLL) STATUS(*ACTIVE) NBROFJOBS(&NBROFJOBS)
      IF           (&NBROFJOBS *EQ 1) DO ...

Either or both the job and user name may be generic values such as:

      RTVJOBSTS    JOB(PAY*) USER(SMI*) STATUS(*ACTIVE)
                     NBROFJOBS(&NBROFJOBS)
      IF           (&NBROFJOBS *EQ 1) DO ...

If no jobs meet the criteria, CPF9898 is sent as an escape message.

The function is implemented using the QUSLJOB API.

Reference from Taatool.

 

RTVJOBA2,  RTVJOBA2A,  and RTVJOBA2B

The  Retrieve  Job  Attributes 2  command  is  similar  to  the  system RTVJOBA  command, but allows  retrieval of  the attributes for  any job and  supports more  parameters.  The  system command is  limited to the current job.   Because  the number  of parameters  exceeds the  maximum that may  be passed to  a CL program  (used for the command processing program),  three  commands  are  supported  (RTVJOBA2,  RTVJOBA2A,  and RTVJOBA2B).

Reference from Taatools: RTVJOBA2, RTVJOBA2A, and RTVJOBA2B

 

 

Post Comments