How to schedule on MPE/iX using MPEX
December 8, 2020
Inside VESOFT covers tips and techniques you can use with VESOFT’s products, especially MPEX.
Some pretty sophisticated job scheduling abilities are inside MPEX/Streamx. They don’t get talked about often, but they are really very cool to use if you don’t already have a scheduler. 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 command (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 below.:
Syntax: %SHOWJOB [mpe showjob parameters] [;[email protected]] [;NOSEC] Examples: %SHOWJOB [email protected] %SHOWJOB SCHED;NOSEC %SHOWJOB [email protected];*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 [email protected] 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=?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:
[;REPEAT= [DAILY|WEEKDAYS|day of week[, ...] ] [;WHENEVER=
[;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):
(BETWEEN(HPHOUR,6,17) and (HPMINUTE=0))
• ...stream a job once a month:
• ...stream a job if another job fails (aborts):
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.
Photo by Brett Sayles from Pexels