NBSpool for MPE Reference Guide

Chapter 5
5-16
The reason that a spoolfile could get printed (altered to
pri=13
) without a banner added is that each
command in the
XEQ
loop executes independently. The
BANNER
command will seek out all
spoolfiles owned by
MGR.PROD
(it only operates on
READY
spoolfiles) and add a banner to them.
The
ALTER
command changes the priority on all spoolfiles created by
MGR.PROD
to
13
. The
problem is that a spoolfile may become available between the execution of the two commands, so
that the
ALTER
will execute, but the
BANNER
will not.
If this process adds a banner and raises priority to
13
for the spoolfile, but does not start printing
before the
60
second delay has expired, then the
BANNER
command will add another banner to the
spoolfile. If the printer is offline, the spoolfile would get larger as more banner pages are added,
and may cause the system to run out of disk space.
Correct Example
Here is a corrected version of the above
XEQ
loop:
XEQ;WAIT=60
BANNER MGR.PROD,%1-11;PRI=12
ALTER MGR.PROD,%12;PRI=13
END
This example is different in the following ways. First, the
BANNER
command has been changed to
operate only on spoolfiles that have output priorities of
1
through
11
(in
NBSPOOL
,
%
is short for
output priority; you can also use
PRI=
1-11
). Second, after each spoolfile is bannered, the priority on
the spoolfile is changed to
12
. Because the
BANNER
command does not select spoolfiles at priority
12
, there is no chance that the
BANNER
command will be executed more than once for the same
spoolfile. Similarly, the
ALTER
command only selects spoolfiles at priority
12
to operate on, so it
will not print a spoolfile until after the banner has been added to it.
This example assumes that the system
OUTFENCE
is at least
12
, so that the
BANNER
command will
not cause the spoolfile to start printing. Also, the
ALTER
command could be removed if the
BANNER
command was altered to
13
instead of
12
.
Some key points to remember are:
If a command does not dispose (
MOVE
,
PURGE
or any command with
;PURGE
option) of a
spoolfile, then use an option such as
;PRI=
with the command to alter the spoolfile so that it is
not processed by the same command on the next execution.
If you need a sequence of commands to operate on the same spoolfile in a specific order, use
the priority trick above to hand the spoolfile from one command to another, or use the
WHILE
command.