The Display Duplicate Jobs command provides a display of jobs based
on a job name. A subfile of jobs that match the selection criteria
is displayed. A detail display of simple job information is
available as well as a function key to access DSPJOB data. The major
intent of the tool is to allow a call to a DSPDUPJOB program with a
return parameter list. This allows the end user to select a job for
further processing when duplicate jobs exist.
A typical command would be entered as:
DSPDUPJOB JOB(xxx)
The jobs that match the job name would be displayed. Option 5 will
display some basic details about a job. If the end user is the same
as the user of the Job or has *JOBCTL special authority, he can
request the DSPJOB function from the detail display.
If only a single job matches the values of the JOB and STATUS
parameters, it is displayed. If no jobs match the value of the JOB
and STATUS parameters, the subfile appears with a special message.
If the DSPDUPJOB function had been called with a parameter list and
the special request for RTV, the 1=Select option would also be
available and the user can select a job. The return parameters would
contain qualified job that was selected. See the later discussion
and sample code.
DSPDUPJOB escape messages you can monitor for
---------------------------------------------
None. Escape messages from based on functions will be re-sent.
Command parameters *CMD
------------------
JOB The qualified name of the job to display. A job
name must be entered or the special value *CURRENT.
The user name defaults to *ALL for all users. A
specific user name may be entered.
The job number defaults to *ALL for all job numbers.
A specific job number may be entered.
STATUS The status of the jobs to be requested. The default
is *ALL for all status values.
*JOBQ may be entered for all jobs on a job queue.
*ACTIVE may be entered for all jobs that are active.
*OUTQ may be entered for all jobs that are completed
and have spooled files that still exist.
TYPRQS The type of request. This is a constant DSP which
is passed to the CPP.
Calling the DSPDUPJOB function from a program
---------------------------------------------
The DSPDUPJOB function may be called directly to allow the end user
to select a job and pass the specifics of the job (Job, User, and Job
Number) back to a program. Assume the user has passed in a fully
qualified job name where the user and job number values may be blank.
If duplicate jobs satisfy the request, you can use the DSPDUPJOB
program directly. You would first want to determine if there are
duplicate jobs of the name that is provided.
The following is typical coding for this function and can be copied
into a program:
DCL &FULLJOB *CHAR LEN(26)
DCL &JOB *CHAR LEN(10)
DCL &USER *CHAR LEN(10)
DCL &JOBNBR *CHAR LEN(6)
DCL &USER2 *CHAR LEN(10)
DCL &JOBNBR2 *CHAR LEN(6)
DCL &RQSSTS *CHAR LEN(7)
DCL &DUPCNT *DEC LEN(5 0)
DCL &JOBSTS *CHAR LEN(10)
DCL &TYPRQS *CHAR LEN(3)
DCL &RTNCDE *CHAR LEN(8)
.
.
/********************************************/
/* */
/* Split job name and check blanks */
/* */
/********************************************/
CHGVAR &JOB %SST(&FULLJOB 1 10)
CHGVAR &USER %SST(&FULLJOB 11 10)
CHGVAR &JOBNBR %SST(&FULLJOB 21 6)
IF (&JOB *EQ '*') DO /* Use current */
RTVJOBA JOB(&JOB) USER(&USER) NBR(&JOBNBR)
ENDDO /* Use current */
IF (&USER *EQ ' ') DO /* Use null */
CHGVAR &USER '*N'
ENDDO /* Use null */
IF (&JOBNBR *EQ ' ') DO /* Use null */
CHGVAR &JOBNBR '*N'
ENDDO /* Use null */
CHGVAR &USER2 &USER
CHGVAR &JOBNBR2 &JOBNBR
CHGVAR &RQSSTS '*ALL'
/********************************************/
/* */
/* Retrieve job status */
/* Fills &JOB etc with first job */
/* */
/********************************************/
IF ((&USER *EQ '*N') *OR +
(&JOBNBR *EQ '*N')) DO /* Get job ID */
RTVJOBSTS JOB(&JOBNBR/&USER/&JOB) STATUS(&RQSSTS) +
RTNSTATUS(&JOBSTS) RTNUSER(&USER) +
RTNJOBNBR(&JOBNBR) NBROFJOBS(&DUPCNT)
ENDDO /* Get job ID */
/********************************************/
/* */
/* If duplicate jobs, call RPG */
/* pgm of DSPDUPJOB. */
/* */
/* If the user selects a job, the */
/* details are returned in */
/* &JOB, &USER, &JOBNBR */
/* */
/********************************************/
IF (&DUPCNT *GT 1) DO /* Duplicate jobs */
RMVMSG CLEAR(*ALL)
CHGVAR &TYPRQS 'RTV'
IF (&USER2 *EQ '*N') DO /* Use *ALL */
CHGVAR &USER '*ALL'
ENDDO /* Use *ALL */
IF (&JOBNBR2 *EQ '*N') DO /* Use *ALL */
CHGVAR &JOBNBR '*ALL'
ENDDO /* Use *ALL */
CHGVAR &FULLJOB (&JOB *CAT &USER *CAT &JOBNBR)
CALL PGM(TAATOOL/TAAJODBR) PARM(&FULLJOB &RQSSTS +
&JOB &USER &JOBNBR &TYPRQS &RTNCDE)
IF (&RTNCDE *EQ 'F3') DO /* Cancelled */
SNDESCMSG MSG('The DSPDUPJOB display was cancelled')
ENDDO /* Cancelled */
ENDDO /* Duplicate jobs */
/********************************************/
/* */
/* Begin your code to process using */
/* &JOB, &USER, &JOBNBR */
/* */
/********************************************/
Restrictions
------------
None.
Prerequisites
-------------
The following TAA Tools must be on your system:
ADJVAR Adjust variable
CVTDAT Convert date
CVTDTS Convert DTS
HLRMVMSG HLL Remove message
RPGSTSDS RPG Status Data Structure
SNDESCMSG Send escape message
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
DSPDUPJOB *CMD TAAJODB QATTCMD
TAAJODBC *PGM CLP TAAJODBC QATTCL
TAAJODBC2 *PGM CLP TAAJODBC2 QATTCL
TAAJODBC3 *PGM CLP TAAJODBC3 QATTCL
TAAJODBR *PGM RPG TAAJODBR QATTRPG
TAAJODBD *FILE DSPF TAAJODBD QATTDDS
|