Inside VESOFT #08 (Spool file management)
by
Shawn Gordon

Ever since spool files became semi-normal files in MPE/XL 2.2, and Spook disappeared, people have been coming up with all sorts of UDC’s and command files to tweak useful information out of the SPOOLF and LISTSPF commands. Of course there is SPOOKNM and SPIFF if you are still missing the old SPOOK syntax.

In any case, MPEX quickly rose to the challenge and implemented all sorts of nifty commands and file objects to manage spool files a number of years ago, but many people are still unaware of the bulk of them. So as is the purpose of this column, we will spend some time going over them so you have even more tools at your disposal.

So first, the most common command would be SHOWOUT.

Syntax:   %SHOWOUT spoolfileset[;listfile]

Examples: %SHOWOUT $STDLIST.@.@
          %SHOWOUT @.@.PROD(SPOOL.JSNAME="COMP010")
          %SHOWOUT @.@.@(SPOOL.OUTPRI>=5)
What you will notice is the (SPOOL.????) Sytax.  This is how you select the spool attribute variables that you are going to want to work on.  These will apply to SHOWOUT, ALTSPOOLFILE and DELETESPOOLFILE.  There is an accessable attribute for virtually any spool file characteristic that you can name.  I’m not going to regurgitate them here, you can see them explained very clearly in the manual.

The output from SHOWOUT looks like this:
%showout $stdlist.@.@
                  MPEX %SHOWOUT $stdlist.@.@   PAGE 1                  
   SYSTEM SERIES 957   MANAGER.SYS,PUB   WED, MAY 17, 2000, 12:52 PM   



SPFile# Filename Pri  JOB#:jobname,user.account,group        Ready Date

#O99    $STDLIST  8  #J'3:FTPMON,FTP.SYS                     02MAR  1:31PM
#O98    $STDLIST  8  #J'2:JINETD,MANAGER.SYS                 02MAR  1:31PM
#O106   $STDLIST  8  #J'3:FTPMON,FTP.SYS                     17MAR  6:42AM
#O117   $STDLIST  8  #J'3:FTPMON,FTP.SYS                     17MAR  1:37PM
#O116   $STDLIST  8  #J'2:JINETD,MANAGER.SYS                 17MAR  1:37PM
#O124   $STDLIST  8  #J'3:FTPMON,FTP.SYS                     21MAR 10:46AM
#O123   $STDLIST  8  #J'2:JINETD,MANAGER.SYS                 21MAR 10:46AM

A related command is SHOWOUTJ, which is really a special purpose version of SHOWOUT, and was originally implemented in VESOFT tech support back when I was working there (but not by me). The idea behind SHOWOUTJ is to make it easy to identify all of the spoolfiles generated by a particular logon.

Syntax:   %SHOWOUTJ [jobsessionname][,user.account]

Examples: %SHOWOUTJ BACKMAN,@.SMGA
%SHOWOUTJ XXX is the same as %SHOWOUTJ XXX,@.@
%SHOWOUTJ ,USER.ACCT is the same as %SHOWOUTJ @,USER.ACCT

So

%SHOWOUTJ X@,Y@.Z@

is the same as saying

%SHOWOUT @.@.Z@(SPOOL.JSNAME MATCHES "X@" and SPOOL.USER MATCHES "Y@")

Here is a quick example of deleting all the $STDLIST files that have been sitting around for a week.

%deletespoolfile $stdlist.@.@(spool.readydate < today-7) -----Deleting #O99, $STDLIST, #J'3, FTPMON,FTP.SYS (16 sectors) -----Deleting #O98, $STDLIST, #J'2, JINETD,MANAGER.SYS (16 sectors) -----Deleting #O106, $STDLIST, #J'3, FTPMON,FTP.SYS (16 sectors) -----Deleting #O117, $STDLIST, #J'3, FTPMON,FTP.SYS (16 sectors)

And of course ALTSPOOLFILE will work in a similar fashion.  

Now to the bit that is the most confusing to me, and that is working on spool files in a REPEAT..FORFILES loop. It’s just confusing because you have to add a couple of extra pieces of information, and the MPEXCURRENTFILE variable will contain the DFID string, so something like “#O1234” instead of the standard FILE.GROUP.ACCOUNT that you are use to.

The format of the REPEAT..FORFILES loop is pretty much the same as you are use to except for some additions to the FORFILES directive. So something like this:

%REPEAT
...
%>FORFILES $STDLIST.@.@(SPOOL.OUTPRI=1):SPOOL

Here we would operate on all the $STDLIST files with a priority of 1. You will notice the “:SPOOL” at the end, this is critical so that MPEX knows where to look for the fileset. Inside the REPEAT loop you access the spool attribute values as “SPOOL.attr” instead of the familiar “RFILE.attr”. So for example if I wanted to display the MPE user id of the creator of the $STDLIST then I would say ECHO ![SPOOL.USER].

There are some fun and interesting possibilities with the MPEX spooler interface, and some advantages over third party spoolers. Most, if not all, third party spoolers will redirect various SPOOLF and LISTSPF commands into a temp file and massage the output for you. In some cases the number of spool files that qualify is larger than the temp file they create, and you have problems, MPEX doesn’t seem to have this problem. A case in point, I had a situation where some unknown program was generating tens of thousands of empty spool files a day, only one or two blank lines in it. If the background process in our third party spooler came down for more than an hour or so, it couldn’t purge the files anymore because too many qualified. I converted this to an MPEX DELETESPOOLFILE command and we never had any more trouble with it, and it had lower overhead. The reason we had all these empty spool files is another story for another day.