Inside VESOFT #02 (Obscure commands)
by
Shawn Gordon

Have you ever wanted to get a quick file count from a group or an account? Usually I would do something like the following:

SETVAR KOUNT=0
REPEAT
   SETVAR KOUNT=KOUNT+1
FORFILES @.@.ACCOUNT
ECHO !KOUNT

This is actually pretty slow, and a fair bit of typing. I found out about an undocumented function the other day that makes this task a lot easier.

CALC FCOUNT(‘@.@.ACCOUNT’)

This works very quickly and displays the file count of the file set.

Here is a documented command that I stumbled across the other day, PAUSEJOB, and its companion command SHOWPAUSED.

Syntax:   %PAUSEJOB "[{time|booleanexpression}]" , userset
          [;VERIFY|NOVERIFY|QUIET]
          [;scheduleparms]
          [;CHECKEVERY=minutes]

          %SHOWPAUSED

Examples: %PAUSEJOB "5:30PM", #J123
          %PAUSEJOB "11:00PM", COMPILE,@.@; NOVERIFY
          %PAUSEJOB "JSCOUNT('@,REPORT.@&EXEC')<=3", REPORT,@.@
          %PAUSEJOB , #J987; IN=0,0,120

The %PAUSEJOB command allows you to SUSPEND (via the :BREAKJOB command) a particular job or jobset (using VESOFT usersets), and have MPEX automatically RESUME the job at a specified future time or when a given expression becomes true.

The syntax for %PAUSEJOB is quite similar to %ALARM. In fact, you must have the ALARM task running under the BACKG job in order for %PAUSEJOB to be able to RESUME the job later. For this reason, if you issue a %PAUSEJOB command and the BACKG job is not already running, MPEX will attempt to start it for you.

You may tell %PAUSEJOB to RESUME the suspended job:

   * at a particular future time (e.g.  "5:30 PM");

   * when a particular boolean expression becomes true (e.g.
     "JSCOUNT('COMPILE,@.@')<=3"); or

   * using the MPE :STREAM-style scheduling parameters ;AT=, ;DAY=, ;DATE=, and ;IN= (e.g.  ";IN=0,0,5" or ";DATE=11/05/91;AT=9:00").

If you specify a jobset (rather than a single job), %PAUSEJOB will list all of the jobs that will be affected and ask

OK to process these jobs (y/n)?

If you don't want to be asked, use the ;NOVERIFY keyword. If you don't even want %PAUSEJOB to list the jobs that it processes, use the ;QUIET keyword (which implies ;NOVERIFY).

PERFORMANCE CONSIDERATIONS (;CHECKEVERY=)

By default, the ALARM background task wakes up once per minute to see if any of the %PAUSEJOB conditions have been met. If you set a %PAUSEJOB alarm based on an expression that will use a lot of system resources to evaluate, you may want to check that particular alarm less frequently.

When you enter a %PAUSEJOB command, simply append the ;CHECKEVERY= keyword to tell the ALARM background task how many intervals to skip between tests. For example:

%PAUSEJOB "JSCOUNT('COMPILE,@.@&EXEC')=0", #J115; CHECKEVERY=10

This means ":BREAKJOB #J115, and when there are no more jobs executing that logged on with a jobname of COMPILE, :RESUMEJOB #J115. Since the default pause time is one minute, this will wait 10 minutes between tests. If you have the pause time of %ALARM set to a value other than 1 minute, then this will vary. If it is set to 2 minutes, then this expression would wait 20 minutes between tests.

VIEWING "PAUSED" JOBS (%SHOWPAUSED)

To find out what %PAUSEJOB commands still have :RESUMEJOB alarms pending for them, use the %SHOWPAUSED command. For each "paused" job that is still suspended, you will be shown the job number, the intro time, the "will resume"time (unless the %PAUSEJOB was set to resume based on a logical expression), and the job name.

This is one of those things that you keep in the back of your head and only use occasionally. You know when too many jobs get started, but you don’t want to mess them up by aborting them, and the operator does a BREAKJOB, and then forgets to start it back up again.

Next time we will cover some other obscure commands, but in future columns I’m going to demonstrate some oddball applications that you can write in just a few lines of MPEX command file code.