The Job Scheduling function allows a convenient means of storing
information about jobs that will be submitted on a regular schedule
and grouping them by category such as daily, weekly, Monday etc. It
then allows a simple means of submitting the jobs for specified
categories.
The Job Scheduling function uses the file JOBSCHP to hold records for
the jobs you want submitted. There is one record for each job and
the job name must be unique. The MTNJOBSCH command maintains this
file (Add, delete, change) and the fields to be entered include:
Job name
Job category (such as DAILY, WEEKLY)
Job description
Job queue
Text description
User name (to be used during execution)
Command to be executed
Since not all of the possible options from the SBMJOB command are
used. A specific job description may be needed in some cases.
You may have as many categories as are needed. When it is time to
submit the appropriate jobs, you would use the SBMJOBSCH command.
For example, if you wanted to submit the DAILY and TUESDAY
categories, you would specify:
SBMJOBSCH CATEGORY(DAILY TUESDAY)
Note that the function does not automatically submit jobs on a
specific date or time. It relies on a manually entered command to
specify the various categories. This differs from the system job
scheduling function.
Scheduling of jobs with a rigid calendar can be difficult to work
with. For example, if you normally do some jobs on Tuesday night,
there may be legitimate reasons that cause the Tuesday jobs to be run
on Wednesday instead of Tuesday. For example, if Monday is a holiday
or a one time critical job must be run on Monday instead of the
normal work, it may push most of the normal work back a day.
Therefore, a manual submit by category may be a practical alternative
that minimizes the amount of individually entered commands.
For flexibility reasons, you may want to have several categories
instead of just a single version. For example, you might use DAILY1
for critical daily jobs, DAILY2 for less critical etc.
CRTJOBSCH command *CMD
-----------------
Creates the job schedule files (JOBSCHP and JOBSCHL) in a named
library.
LIB The library to create the files in.
SRCLIB The source library to use for the QATTDDS file. The
default is *TAAARC which means to use the source in
the TAA Archive.
MTNJOBSCH command *CMD
-----------------
Maintains the JOBSCHP file. There are no parameters. A prompt
screen is displayed and allows options to display, change, add or
delete the records from the master file.
JOB The unique job name to identify the job.
ACTION The type of action to be performed on the job
record. The entries are *ADD, *CHG, *DLT and *DSP.
*CHG is the default.
SBMJOBSCH command parameters *CMD
----------------------------
Submits the jobs from the JOBSCHP file for the categories specified.
CATEGORY A list of up to 20 category names which can be
specified.
PRTJOBSCH command parameters *CMD
----------------------------
Prints the JOBSCHP file in one of two sequences.
SEQ The default is *JOBCAT which will cause the file to
be printed in sequence by Job category, Job sequence
and Job name.
*JOB will cause the printing in Job name sequence.
JOBSCHP file
------------
The fields to be entered are fairly obvious from the prompts with a
few exceptions:
JBSEQ This is a sequencing field to allow the jobs for the
same category to be submitted in a specified
sequence. This is a 5 byte character field with a
default of '50000'. The collating sequence of JBSEQ
determines which job for the category is submitted
first. Jobs with the same sequence value are
submitted in name order.
JBTEXT This is a text field to help describe the job. It
is not used during processing.
CMD The command to be executed in batch. You can prompt
for this command by entering a '?' such as:
?RGZPFM
The command string following the command prompt will
appear in the CMD field to allow you to confirm the
entry. The command is checked with the QCMDCHK
function when it is entered.
If you want to enter a command with an apostrophe,
you must use 4 apostrophes. For example, assume you
want a TEXT description of:
O'Neils library
You must enter the command as:
... TEXT('O''''Neils library')
Submit job parameter implications
---------------------------------
The SBMJOBSCH command causes one or more jobs to be submitted. The
majority of the parameters will be taken from the specified job
description (QBATCH is the default). The following will not:
USER The value in the JOBSCHP record is used. The same
entries as exist on SBMJOB may be used (a name,
*CURRENT, or *JOBD). The default is *CURRENT
meaning that the user who entered the SBMJOBSCH
command will be used (not the user who entered the
record with MTNJOBSCH).
JOBQ The job queue in the JOBSCHP record is used. The
default is QBATCH in QGPL.
CMD The command to be entered. This is used to specify
the RQSDTA parameter on SBMJOB.
CURLIB The value *USRPRF is specified. If the data base
record has a value for USER other than *CURRENT,
then the name of that user is used and his current
library is used for the batch job. If the data base
record specifies *CURRENT, then the submitting
user's current library is used.
INLLIBL The value *JOBD is used. When a JOBD is created,
the INLLIBL default is *SYSVAL meaning the QSYSLIBL
system value. You may need to specify the proper
libraries in a JOBD to correctly execute the
submitted job.
Note that the library list used is from the job description and not
from the job which enters SBMJOBSCH.
Security implications
---------------------
No checking occurs on the USER or JOBD field in the JOBSCHP record
during the MTNJOBSCH command. Therefore, anyone may enter values
regardless of whether they are authorized to the objects.
When the SBMJOBSCH command is executed, it will issue a SBMJOB
command with the USER parameter filled in from the job record in the
JOBSCHP file. The normal security checking for any SBMJOB then
occurs.
** If a user name is specified, the system will ensure that the
submitter is authorized to the user profile named.
** If USER(*JOBD) is specified, the submitting user must have
*USE authority to the job description.
You may want to authorize the JOBSCHP file so that not all users can
enter job records. You may also want to control who executes the
SBMJOBSCH command.
Prerequisites
-------------
The following TAA Tools must be on your system.
ALCTMPMBR Allocate temporary member
CHKAPOST Check apostrophe
EXTLST Extract list
EDTVAR Edit variable
SNDCOMPMSG Send completion message
SNDDIAGMSG Send diagnostic message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
TAAARC TAA Archive
Implementation
--------------
The tool is ready to use, but the the CRTJOBSCH command must be used
to create the files in one of your libraries.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
JOBSCH *DTAARA No source
* JOBSCHP *FILE PF TAAJOBLP QATTDDS
* JOBSCHL *FILE LF TAAJOBLL QATTDDS
TAAJOBLD *FILE DSPF TAAJOBLD QATTDDS
MTNJOBSCH *CMD TAAJOBL QATTCMD
SBMJOBSCH *CMD TAAJOBL2 QATTCMD
PRTJOBSCH *CMD TAAJOBL3 QATTCMD
CRTJOBSCH *CMD TAAJOBL4 QATTCMD
TAAJOBLC *PGM CLP TAAJOBLC QATTCL
TAAJOBLC2 *PGM CLP TAAJOBLC2 QATTCL
TAAJOBLC3 *PGM CLP TAAJOBLC3 QATTCL
TAAJOBLC4 *PGM CLP TAAJOBLC4 QATTCL
TAAJOBLR *PGM RPG TAAJOBLR QATTRPG
TAAJOBLR2 *PGM RPG TAAJOBLR2 QATTRPG
TAAJOBLR3 *PGM RPG TAAJOBLR3 QATTRPG
* These files will exist in the library specified for CRTJOBSCH.
Structure
---------
CRTJOBSCH Cmd
TAAJOBLC4 CL
MTNJOBSCH Cmd
TAAJOBLC CL
TAAJOBLR RPG
JOBSCHP PF (read, update, add, delete)
SBMJOBSCH Cmd
TAAJOBLC2 CL
TAAJOBLR2 RPG
JOBSCHP PF (read, update)
PRTJOBSCH Cmd
TAAJOBLC3 CL
TAAJOBLR3 RPG
JOBSCHP PF (read)
JOBSCHL PF (read)
|