NBSpool for MPE Reference Guide

Background Processing
5-15
Tips on Writing Background Jobs
This section provides some tips on writing background jobs. These tips include information on
choosing a value for the
;WAIT= parameter and avoiding faulty logic in XEQ loops.
Choosing a Value for the WAIT= Parameter
When choosing values for the ;WAIT= parameter in the XEQ command, you must consider the
following effects:
The load that
NBSPOOL will place on the system
The delay that will elapse between the time a spoolfile becomes ready for
NBSPOOL to perform
some action on it
The time that the action takes place
The parameter is specified in seconds, so typical values are
60
or
120
(one or two minutes). For
simple processes values as low as
10
or
20
seconds can be used without placing a significant load on
the system. If you run very complex
XEQ scripts or many NBSPOOL processes in parallel (with the
;BACKGROUND option), and the NBSPOOL CPU usage becomes noticeable, you may wish to increase
the
;WAIT= values.
Sample XEQ Loops
The following sections are two examples of XEQ loops. The first example has faulty logic. The
second example shows how to successfully handle adding banners to spoolfiles.
Incorrect Example
XEQ;WAIT=60
BANNER MGR.PROD
ALTER MGR.PROD;PRI=13
END
This sample adds banner pages to all spoolfiles created by MGR.PROD. It changes the output priority
on all spoolfiles created by
MGR.PROD to
13
(so that they will print), and delays for
60
seconds
before starting over again.
In this example, the user intends that all spoolfiles created by
MGR.PROD be printed with a banner.
Two problems exist with this. The first problem is that spoolfiles can get printed without a banner,
and the second problem is that some spoolfiles may end up getting multiple banners added to them.