Submitting batch jobs from the terminal
On a mainframe, batch jobs allowed users to execute long running jobs without tying up their terminal - and reduce the cost of running jobs by scheduling them to quieter parts of the day.
On Hercules, where you can run a number of terminals and don’t get charged for your work, the benefits are less obvious - but it is interesting to learn how batch jobs were processed and it also opens up the possibility of submitting jobs from your host OS to MTS without having to log on.
Creating a job
For a simple example we’ll use the $calc
command to do some calculations.
Create a file - any name will work but we’ll use calc.run
and edit it, inserting the below contents:
$signon *
$calc
a = 10
b = 13
c = 7
n = (a * b) / c
list
$endfile
$signoff
The first line should be a $signon
command. As you are submitting from the terminal and are already logged in you don’t need to provide username or password and the *
means run under the current user. On this line you could also set options to limit the amount of resources used or control printing.
After that come the commands to execute, which are processed just like they were entered from the keyboard. So here we start the $calc
command then provide it a number of commands up to the $endfile
which exits $calc
.
The last line of the file should be $signoff
to show the job has ended.
Submitting to HASP
To submit the job, you copy the command file to the *BATCH*
pseudodevice:
$copy calc.run *batch*
HASP will receive the contents of the file and schedule the job, giving you a job number eg
> *BATCH* assigned receipt number 600026
*BATCH* 600026 released.
At this point, the command file is no longer needed as HASP will make a copy.
Getting the results
On a single user system you should be able to get the results immediately. Check the printer file Units/PTR2.txt
and you will see the output after the usual header page:
$SIGNON ST01
No Charges
Last signon was at 10:50:32, Thu Aug 13/14
User ST01 signed on at 15:19:43, Sat Aug 16/14
$calc
A = 10
B = 13
C = 7
N = 18.5714285714285694
$signoff
Further information
The chapter called “Batch use of MTS” in MTS Volume 1 gives an overview of running batch jobs, including setting extra parameters and controlling the queue.
In a future post I will look at submitting jobs using the card reader.