Inside VESOFT #12 (Job Scheduling)
by
Shawn Gordon
Some time back there was some pretty sophisticated job scheduling abilities put into MPEX/Streamx. They don’t get talked about often, but there are really very cool to use if you don’t already have a scheduler, and you have MPEX/Streamx. Since this does rely on Streamx, it will be necessary for you to own Security/3000 for it to work. The SHOWJOB was enhanced to support this, a new commands, SHOWSCHED was added to give direct support, and a new parameter was added to STREAMX, ::SETSCHEDULE that does some basic interfacing.
First let’s take a look at the SHOWJOB command:
Syntax: %SHOWJOB [mpe showjob parameters]
[;JOB=@A]
[;NOSEC]
Examples: %SHOWJOB JOB=@A
%SHOWJOB SCHED;NOSEC
%SHOWJOB JOB=@.SYS;*LP
%SHOWJOB
JOBNUM STATE IPRI JIN JLIST INTRODUCED JOB NAME
#S2 EXEC 20 20 WED 7:41A SHAWN,MANAGER.SYS
#J3 EXEC 10R LP WED 7:43A BACKG,MANAGER.VESOFT
#S3 EXEC 2 2 WED 8:05A SHAWN,MGR.SMGA
3 JOBS:
0 INTRO
0 WAIT; INCL 0 DEFERRED
3 EXEC; INCL 2 SESSIONS
0 SUSP
JOBFENCE= 6; JLIMIT= 2; SLIMIT= 40
JOBNUM STATE R SCHED-CONDITION SCHEDULED-INTRO JOB NAME
#A1 SCHED + SMTWRFA 0:10 FYIMAIL8,MGR.SMGA
#A2 SCHED + -MTWRF- 0:15 DAILY,MANAGER.SYS
#A3 SCHED + S-----A 0:35 DISCLEAN,MANAGER.SYS
#A4 SCHED + -MTWRF- 1:30 BACKUP,MANAGER.SYS
#A5 SCHED + WHENEVER BETWEEN(HPDAY,2,6) AND... DBTREND2,MANAGER.SYS
#A6 SCHED + WHENEVER (HPDATE=1) REPORT,MANAGER.SYS
#A7 SCHED FRI 9/16/94 10:00 TESTSCHD,MANAGER.SYS
7 STREAMX SCHEDULED JOBS.
The MPE :SHOWJOB command has been enhanced to display STREAMX scheduling information as well as MPE :SHOWJOB information. When appropriate, STREAMX scheduling information is automatically displayed after the status section of the MPE :SHOWJOB command. In addition, VESOFT has created a new %SHOWJOB userset of @A to represent all STREAMX scheduled jobs.
The SCHED-CONDITION/SCHEDULED-INTRO columns display different information depending upon whether or not the job repeats on specific days, is scheduled to submit on a particular day and time or if the job should be launched when a particular condition occurs. Repeating jobs are indicated by a “+” character after the word “SCHED”. For jobs that are scheduled for a particular day and time, that information is displayed much the same as MPE scheduled jobs. For conditional jobs, as much of the condition that can be displayed on one line
will be printed, followed by “…” if the conditional expression is longer.
This is essentially the same format as the %SHOWJOB command, and shows the same information as the %SEC SHOWSCHED command. %SEC SHOWSCHED, however, will display the entire condition under which a job will be submitted, as you can see here:
Last -Days-
#A Job Name Submitted By Job # SMTWRFA -Time-
--- ------------------------ ----------------------- ------ ------- ------
6 REPORT,MANAGER.SYS SMG,MANAGER.SYS J1032
WHENEVER (HPDATE=1)
CHECKEVERY DAY
Since the default is to display both jobs and sessions, simply typing %SHOWJOB alone will display MPE jobs and sessions, MPE scheduled jobs, the MPE status block, and STREAMX scheduled jobs in that order. To display only STREAMX scheduling information, type %SHOWJOB JOB=@A. To suppress STREAMX scheduling information, include ;NOSEC as part of the command.
With the ::SETSCHEDULE command, the job stream can specify its own scheduling parameters, e.g.
!JOB DELSPOOL,MANAGER.SYS; OUTCLASS=,1
::SETSCHEDULE AT=02:00
...
or
::SETSCHEDULE AT=?When would you like to schedule this job for?
What follows the ::SETSCHEDULE must be the :STREAM command scheduling parameters, exactly as they’d be specified after the “;” in the :STREAM command (e.g. “::SETSCHEDULE AT=02:00;DAY=MONDAY”).
Note that if the user explicitly specifies scheduling parameters when he runs STREAMX (e.g. in the STREAMX UDC), those parameters will be used and any ::SETSCHEDULE command in the file will be ignored. This lets a user override the ::SETSCHEDULE settings in the file.
Also note that if you specify several ::SETSCHEDULE commands in one job stream, the FIRST one will take precedence. It’s important to note that the new parameters can be specified at submission or with the ::SETSCHEDULE. So the STREAM command through STREAMX now supports the following syntax:
:STREAM filename
[;REPEAT= [DAILY|WEEKDAYS|day of week[, ...] ]
[;WHENEVER= condition]
[;WHEN= condition]
[;CHECKEVERY= minutes| DAILY ]
[;MPE SCHED PARMS]
It’s the “condition” that is so flexible in this new format, check out some of these examples:
...stream a job at a scheduled time each day: :STREAM MAINJOB ;REPEAT=DAILY ;AT=01:00 ...stream a job several times each day (once each hour): :STREAM XPMAIL.MAILJOB.SYS;& WHENEVER=(BETWEEN(HPHOUR,6,17) and (HPMINUTE=0)) ...stream a job once a month: :STREAM REPORT.JOB.SYS;WHENEVER=(hpdate=1);CHECKEVERY=DAILY ...stream a job if another job fails (aborts): :STREAM RECOVER.JOB.SYS; WHEN=JSCOUNT('POST,MGR.PAYROLL')=0
The hard part really is just in making sure that your syntax and parameters are exactly what you want. Some trickier stuff you might try to do would be when you want to stream job A when job C finishes with no errors, but stream job B if it fails for some reason. All of this can be done, it just takes a little think time.
To wrap up I’m going to pick one of my few nits with VESOFT. I had a heck of a time with this column because the HELP and manual are so poorly arranged to cover these new features. This is very unusual for VESOFT, but as I went through the doc I realized that it hasn’t been updated in years now. There is an FAQ file in the VESOFT account, but this is not adequate, as it is serial to view and is not connected to the documentation system. VESOFT needs to spend a little time and get the manual and online help up to date and in sync with the product, it would save people a fair amount of time.