home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug044.arc
/
SUPERSUB.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
8KB
|
208 lines
SUPERSUB
A replacement for the CP/M SUBMIT utility
Ron Fowler
Nov. 16, 1981
Westland, Michigan
One of the most useful programs provided with CP/M is the
SUBMIT utility, which allows system commands to be read from a
disk file for automatic processing. Its command-line
substitution facility provides a convenient means of developing
"prototype" command files, with actual parameter substitution
performed when the command file is invoked.
There are, however, some shortcomings associated with
SUBMIT that recur frequently. Frequently enough to inspire me
to write my own batch processor, SUPERSUB, that completely
replaces, and is fully compatible with, the standard SUBMIT
utility.
PROBLEMS WITH SUBMIT
SUBMIT will produce a "garbaged" output file whenever it
encounters an empty line in the input file. This is a real
handicap when attempting to pass command lines to PIP.COM, for
example, using XSUB (the CP/M2 utility that extends the SUBMIT
capability to transient programs), since the only way to exit
PIP is to enter an empty command line (you can enter a control-
"C" as the first character of the line, but this is a "real-
time" function, and cannot be done within a SUBMIT file).
SUPERSUB generates the necessary zero-length line in the output
file.
Another SUBMIT drawback is the constant need to enter an
editor and create a command file, even for the simplest of
jobs. This added step discourages the use of SUBMIT for very
simple "command stacking" applications. With this in mind, I
gave SUPERSUB the ability to interactively accept command lines
from the console. An additional option allows the entire job
to be specified on the SUPERSUB command line.
COMMAND FILE NESTING
I felt that a nesting capability would be a significant
feature to add to SUPERSUB. For example, it would be useful to
create a submit file called COMPILE.SUB, to facilitate the
program compilation process, and "clean up" any leftover files.
COMPILE.SUB might look like this:
BASCOM =$1 ;COMPILE PROGRAM SPECIFIED IN CMD LINE
L80 $1,$1/N/E ;LINK THE PROGRAM
PIP B:=$1.COM ;MOVE THE OBJECT FILE TO THE B DRIVE
ERA $1.REL ;DELETE THE .REL FILE
ERA $1.COM ; AND THE OBJECT FILE
Now let's say I want to compile several programs at once
(a common situation in applications programming). Under
SUBMIT, I would have to type in a SUBMIT invocation for each
program:
A>SUBMIT COMPILE LEDGER [COMPILE.SUB executes, operator waits
for it to complete, then types:]
A>SUBMIT COMPILE PAYABLES [more waiting for COMPILE.SUB, then:]
A>SUBMIT COMPILE RECVBLES [and the job is finally done.]
Using SUPERSUB, I can create a file (CMPILALL.SUB)
containing the commands
SUBMIT COMPILE LEDGER
SUBMIT COMPILE PAYABLES
SUBMIT COMPILE RECVBLES
and execute the whole thing with the single command line
A>SSUB CMPILALL
(Note that I've abbreviated SUPERSUB to SSUB on all my disks;
SUPERSUB as a name is a bit grandiose anyway). I can also save
the trouble of creating CMPILALL.SUB (especially if I want to
do this only once) and enter the single command line
A>SSUB /COMPILE LEDGER;SSUB COMPILE PAYABLES;SSUB COMPILE RECVBLES
or, if the individual command lines to be executed are a bit
long, I can specify the Interactive mode by entering only a
slash ("/") on the command line (after the SUPERSUB
invocation). SUPERSUB will then prompt for each command line
with an asterisk. To continue the previous example,
A>SSUB /
*COMPILE LEDGER
*SSUB COMPILE PAYABLES
*SSUB COMPILE RECVBLES
* [empty line here terminates]
ON-LINE HELP FUNCTION
I believe all programs of any complexity should be "self-
instructive" by providing the user a means of typing out, on
the terminal, the major modes of operation, and any necessary
command line syntax. Further, the command line used to invoke
this "help summary" should be the simplest possible form not
otherwise used by the program. In the case of SUPERSUB, this
is a command line with no arguments at all:
A>SSUB
SUBMIT.COM COMPATIBILITY
SUPERSUB is fully compatible with CP/M's SUBMIT utility,
including command parameter substitution and control-character
translation:
1) Parameters within the "prototype" file, of the form $1,
$2, etc., are substituted from the command line on a one-
for-one basis. Parameters are passed through to any
nested files. Two successive dollar-sign characters
("$$") may be used to introduce a single "$" into the
output file.
2) An up-arrow symbol ("^") may precede an alphabetic
character to insert the associated control-character into
the output file.
DETAILED INSTRUCTIONS
In addition to the normal SUBMIT mode of operation and
associated command line usage, SUPERSUB provides two additional
modes of input: Interactive and Summary.
SUMMARY MODE
Summary mode allows the entire SUBMIT job to be specified in
the CP/M command line. This mode is enabled by using the slash
("/")character as the first character of the command line. The
individual submit lines must be seperated with a semicolon. For
example,
A>SSUB / CRCK *.* F;CRCK B:*.* F;COMPARE CRCKFILE.CRC B:
^
|
----> (this space is optional)
will create a file of CRC's of all files on A:, then create a
similar file on B:, then compare the two. (CRCK, by Keith
Petersen, and COMPARE, by Ward Christensen, are available from
the CP/M Users Group).
INTERACTIVE MODE
You may enter the interactive entry mode by typing
"SUPERSUB /<CR>" (ie, "SUPERSUB /" with no arguments).
Supersub will prompt for input with an asterisk, and you may
then enter SUBMIT lines from the keyboard. Multiple commands
may be entered on a line by separating them with semicolons.
An empty line terminates the input. Example:
A>SUPERSUB /
*CRCK *.* F
*CRCK B:*.* F
*COMPARE CRCKFILE.CRC B:
* <empty line here>
A>CRCK *.* F <submit file begins execution>
has the same effect as the above SUMMARY mode example.
HELP FUNCTION
Typing SUPERSUB with no arguments will print the built-in help
file.
NOTES
1) Nested SUBMIT runs are only usable up to a maximum of 128
nested commands at any one time. This is a limitation of
the CP/M Console Command Processor.
2) If you change the drive specification for the output file,
you may want to do the same thing with XSUB (Digital
Research's function nine extender). Within XSUB, find the
submit File Control Block (search for "$$$ SUB" within
XSUB.COM) and change the first FCB byte (ie, the byte
before the first "$") to:
0 - to use default drive
1 - to use drive A:
2 - to use drive B:
etc.
3) In SUMMARY and INTERACTIVE modes, passed parameters have no
meaning. When these modes are used, the parameter flag,
"$", will be passed through literally to the output file.
4) Zero-length output lines may be created in SUMMARY and
INTERACTIVE modes by using two consecutive semicolons. This
is, in effect, a blank logical line.
5) Interactive mode may be aborted by typing control-C as the
first character of a line. Also, all normal CP/M editing
characters are available in this mode.