Submitting batch jobs from the reader

punch The IBM 29 card punch, from a film at the Deep Blue collection at the University of Michigan

In the previous post we looked at submitting batch jobs from the terminal; this time we will submit jobs from outside MTS using the emulated card reader. Using this method you can create jobs using a text editor on your host OS, submit to MTS and collect output without having to sign on interactively.

On Hercules, the emulated card reader accepts ASCII format text files, with each line representing one card. On MTS, the HASP batch scheduler reads cards from the reader and sets up batch jobs, with any output going to the printer.

Compared to submitting jobs from the terminal, you will need two additional items: a S8 card and full sign-on details.

S8 cards

For the first card in your job you will need a S8 card. This acts a header for batch jobs submitted to the reader and includes the number that will be used as the batch sequence ID.

According to the FAQ, these were handed out to users at the computer centre in UM for users to attach to their jobs and were then returned as a receipt when the job had finished.

You can create S8 cards by running the operator job *RCP and directing output to the card punch.

Switch to the MTS operator’s console. Enter $DRAIN PCH1 to get HASP to let go of the punch then MTS *RCP. Enter >PCH1, NO and two six digit numbers to select the range of IDs. Then $START PCH1 to give control of the punch back to HASP. The console should look like the below.

$DRAIN PCH1
$*OK
MTS *RCP
00053..MTS *RCP
00053 MTS  MTS RECEIPT CARD PROGRAM 
00053 MTS  ENTER THE NAME OF THE PUNCH
>PCH1
00053 MTS  ENTER YES IF RECEIPT CARDS WANTED, NO IF ONLY DECK CARDS WANTED
NO
00053 MTS  ENTER SIX DIGIT STARTING RECEIPT NUMBER
100000
00053 MTS  ENTER SIX DIGIT ENDING RECEIPT NUMBER
100100
00053 MTS  ALL RECEIPT CARDS HAVE BEEN PUNCHED
$START PCH1

If you take a look at the punch file Units/PCH1.txt, the first three lines should look like the below:

\                 100000               DECK                             100000 .
\                 100001               DECK                             100001 .
\                 100002               DECK                             100002 .

You can now cut lines from this file and paste into your batch job file at the top. It is possible to reuse cards/IDs once the job using an ID has finished, but it’s best to use a new S8 card for each job.

Sign-on details

For interactive submission you could use $signon * as MTS knew what user ID submitted the request. For card reader submission you need to supply the user name, eg $signon st01, and in the next card supply the password.

Putting it together

So as an example let’s do the simple calculation job again.

Create a file on your host operating system. For the first line, cut the first S8 card from the punch file. For the second and third line provide the sign-on ID and password. The rest of the job is as before.

The file should look something like this:

\                 100000               DECK                             100000 .
$signon st01
st01
$calc
a = 10  
b = 13  
c = 7  
n = (a * b) / c  
list  
$endfile
$signoff

Submitting the job and collecting output

Copy your batch file to Units/RDR.txt, overwriting the current contents.

Switch to the Hercules operator’s console and type devinit c to bring the reader online.

HASP will read the job, execute it and print output to the printer file. Look in Units/PTR2.txt and you will see output like the below, surrounded by the usual header and footer:

$SIGNON ST01
No Charges
Last signon was at 21:55:55, Sun Aug 23/14
User ST01 signed on at 22:38:11, Sun Aug 23/14



$calc
A        = 10
B        = 13
C        = 7
N        = 18.5714285714285694
$signoff

Copying files into MTS

You can use this batch job submission technique to send files into MTS. Say you want to send this file

Hello world
Welcome to MTS!

to the file DELTA owned by ST01. You could create a batch job similar to the below:

\                 100001               DECK                             100001 .
$signon ST01
ST01
$create delta
$copy *source* delta
Hello world
Welcome to MTS!
$endfile
$signoff

Further information

See the Operator’s manual for details of the *RCP job.

To see how physical cards were punched by users before submitting them to MTS take a look at the film Basic Operation of the IBM 29 Card Punch from 1967 at UM.


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.


Editing files

So far we’ve been using $COPY *SOURCE* file to create text files - for more complex editing we need to get to grips with the MTS editor. This post will give a quick introduction focusing on the visual editing mode.

Coming from a Unix or Windows background, the MTS editor will use an unfamiliar set of keys but once you learn them it is easy to use. There are some interesting features such as an integrated, editable copy and paste/command execution area, and the ability to remember locations and jump to them quickly.

Starting up and exiting

Enter $EDIT gamma to start editing file gamma. Remember you have to $CREATE the file in MTS if it does not exist already.

Initially you will be in command mode with a : prompt; type VISUAL or just V to enter visual mode.

Hit PA2 to get out of visual mode and PA2 again to quit the editor and get back to the MTS command line.

The editor makes heavy use of the PF function keys so check with your 3270 terminal emulator documentation on how to access these. Often they are bound to PC function keys, ie PF1 can be issued by pressing F1.

Screen arrangement

On entering visual mode for a new file the screen will look like this:

edit work area

The bottom line shows a ruler and the last but one line shows the cost of the edit session (not applicable on Hercules of course) and the work field, used to hold copied text and enter commands. The rest of the screen is used to view and edit text.

Entering text

You can start typing text immediately. The cursor keys allow you to move back and forth in the line; the delete and backspace keys work as expected also.

Insert will switch to overwrite mode; on my emulator at least I find I need to press Enter to switch it off.

Press Newline to start a new line; the line number will not be displayed immediately. Press Enter to ask the editor to refresh the screen and set the line number.

Tab will move to the start of the next line; Backtab will move to the start of the current line if in the middle of a line, else the previous line.

If you move the cursor down a number of lines and start typing then press Enter, the line number given will reflect the gap and the text will move up so no gap is displayed.

Scrolling around

For documents larger than one screen, press PF1 to scroll up one page and PF4 to scroll down. PF7 will scroll down one line. HOME will move to the top of the window.

Moving the cursor up from the top of the screen or down from the bottom will not scroll; instead the cursor will wrap around to the bottom or top.

The editor can remember your location in the file and return to it after you have moved. To set memory location 1, press PF3 two times in a row. After you have moved, press PF3 once to return to that location. PF6 and PF9 can be used similarly to set and return to memory locations 2 and 3. Initially the memory locations are defined as:

  • Memory 1 - first line of file
  • Memory 2 - line 1000 of file
  • Memory 3 - last line of file

Copy and paste and the work field

A form of copy and paste is done using the work field at the bottom of the screen. Press PF2 to copy from the cursor to the end of the line to the work field. Press PF5 to paste the contents of the work field at the cursor position.

You can jump to the work area with SysReq and edit what’s there to control what is pasted..

You can also enter line-orientated commands in the work area and execute them with PF8.

Note that instead of using this you can use the native functions provided by your host operating system to copy and paste.

Insert and delete lines

EraseEOF will delete the rest of the line or the whole line if the cursor is at the start of a line.

PF10 will insert a new line below the current line. Repeatedly pressing it will insert 2x the number of blank lines each time, so press twice for two lines, three times for four lines, four times for eight lines and so on.

There is no predefined key to split a line into two. To do this, type VSPLIT into the work area. Move the cursor back to the place you want to split and press PF8 to execute the split command.

Line numbering

The editor will handle line numbers. If you have line 1 and line 2 entered but want to add a line in between (by pressing PF10) it will use line number 1.5. Remember you can use the $RENUMBER command back at the MTS command prompt to turn an uneven sequence of lines into 1, 2, 3 etc.

Line extensions

When you reach the right end of the screen while typing a line the editor will not let you continue. Press PF11 to extend the line onto the next row of the screen and you can keep typing.

Saving and undo

There is no explicit save command - the file is saved back to disk when the screen is refreshed (eg on scrolling or with Enter) or when you exit visual mode. Because of this it is a good idea to make a backup of important files before you start editing them.

It is possible to undo all changes done in the current editing session. Switch back to command line mode (with PA2) and type UNDO at the : prompt.

Summary of PF keys

  • PF1 Scroll up ten lines
  • PF2 Append rest of line to work area
  • PF3 Memory 1
  • PF4 Scroll down ten lines
  • PF5 Insert contents of work area in current line
  • PF6 Memory 2
  • PF7 Scroll up one line
  • PF8 Executes contents of work area as command
  • PF9 Memory 3
  • PF10 Insert line
  • PF11 Extend current line
  • PF12 Move to the previous position

Command mode

The editor also contains a rich command mode which I will not go into in depth here. Some simple examples:

: PRINT
Print the current line

: +1
Move forwards one line

: ALTER 'aa'bb'
Find the first occurrence on the current line of aa and replace with bb

: ALTER@ALL 'cc'dd'
Replace all occurrences of cc with dd on the current line

: ALTER@ALL /FILE 'ee'ff'
Replace all occurrences of ee with ff in the whole file~

More information

See MTS Volume 18, The MTS File Editor for complete documentation; also look at the online help by typing HELP from the editor command mode prompt.


Extracting files using the card punch

punched card FortranCardPROJ039.agr by Arnold Reinhold. Licensed under CC BY-SA 2.5 via Wikimedia Commons

Punched cards were a way to get code and data into and out of the IBM mainframe. Under Hercules you can use the emulated card punch as a way to get ASCII format text files out of the system.

Setup

As per printing in MTS you will need HASP up and running to use the card punch.

Submitting the request

To send files to the card punch, direct them the *PUNCH* pseudodevice in the same was as you direct print files to *PRINT*. Use $LIST to include line numbers and $COPY to send file as is.

Note that there is a maximum of 80 characters per line and carriage control characters will not format the output.

For example, say you have a file ALPHA with two lines:

Hello world!
Welcome to MTS.

To send this file to the punch do:

# copy alpha *punch*
> *PUNCH* assigned receipt number 600020
  *PUNCH* 600020 released, 3 cards, croute=CNTR.

As for print jobs, the system will assign a job number, here 60020. The punch prints one card per line with an extra card first as a header.

Collecting output

From your host computer, look at the file Units/PCH1.txt.

 COM  -0-     &&  &&   jjjaaa              -0-     &&  &&   jjjaaa      M 600020
Hello world!
Welcome to MTS.

The first line is the header card, showing the job number. The rest of the file is the same as the file you sent from MTS.

Clearing the card punch

After you submit a job, the card punch will go offline and will not punch any further jobs until you clear it. On the mainframe this was presumably to allow the operator to separate different card outputs and arrange delivery.

On the operator’s console you can see that the punch needs attention as the letters PCH1 will be displayed in bold on the third line.

To clear the punch, go to the Hercules console and type devinit 000d. This will bring the punch back online and the next job will be punched - replacing the contents of host file PCH1.txt.

Further information

Although you could use the card reader to move data from the outside world into the MTS system, the default set up is that HASP uses it to receive batch jobs. This will be covered in a future post.

Another way to get data into and out of the system is using emulated tapes which we will also look at later.


Printing in MTS

MTS has a rich set of options for handling printed output, suitable for a mainframe with many users sharing multiple printers.

Running under Hercules, the printer is emulated by writing ASCII text output to a file. Once you issue a print job within MTS you can view the file from your host operating system. This is a useful way to extract text files from MTS.

Setup

In order to get printing working you need the print device to the configured correctly (see part 1) and HASP needs to be running (see part 2). Once this is done you can direct output to the *PRINT* pseudodevice and HASP will spool this for printing. With the default D6.0A configuration this will print to the file Units/PTR2.txt.

If you have problems with this see the D6.0A FAQ question 21 for an alternative way to print.

Printing text files

The LIST command takes a second argument to determine where to send the output. By specifying *PRINT* you can send this to the print queue.

LIST alpha *PRINT*

MTS will respond with the receipt number for the print job, for example:

> *PRINT* assigned receipt number 600011
> *PRINT* 600011 released, 3 pages, route=CNTR.

On a real shared mainframe it may take time for your job to reach the front of the queue and complete printing (although mainframe line printers were very fast), but on Hercules your output will be available almost immediately.

Switch back to your host operating system and look at the printer file - you will see output like this.

print1 print2

There is a header page in large type showing the username and print receipt number first, then the actual output (2 lines here) and finally a footer page with a summary of the job.

Carriage control

Some MTS files have carriage control instructions: these are characters in the first column of each line telling the output device driver how to format the file, eg overprint or centre line.

For these files you need to use $COPY to send the file to the printer (or screen).

For example, let’s look at the first ten lines of the *CCMEMOS file. If we use $list *ccmemos(1,10) *print* we get the below output; note the carriage control characters like 1, - and 0 in the first column after the line number.

Listing of *CCMEMOS(1,10) at 23:08:07 on JUL 26, 1914 for CCid=REL. on MT       
                                           Page    1

     1     1
     2     -
     3                                      *CCMEMOS
     4     0                               April 1988
     5     0         Current Computing Center Memos are available for checkout o
r
     6          in filing cabinets at all Campus Computing Sites.
     7     0         The Computing Center's Documentation Support Staff (313-763
-
     8          7624) or $MESS send to CC_Doc_Support_Staff, will mail  CC  Memo
s
     9          to  individual  users  who  cannot  pick  up copies at one of th
e
    10          public stations, for example, those who live out-of-town. We wil

If instead we use the command $copy *ccmemos(1,10) *print* we get this formatted output.

                                *CCMEMOS

                               April 1988

         Current Computing Center Memos are available for checkout or
    in filing cabinets at all Campus Computing Sites.

         The Computing Center's Documentation Support Staff (313-763-
    7624) or $MESS send to CC_Doc_Support_Staff, will mail  CC  Memos
    to  individual  users  who  cannot  pick  up copies at one of the
    public stations, for example, those who live out-of-town. We will

MTS has a large number of options to adjust how print output is processed. Many of these are no longer applicable (eg which physical printer to send it to, where the operators should deliver the hard copy). Look at the online help for SET to learn more.

Text formatters

MTS comes with a number of formatters that will take a marked up file and return output with carriage control.

  • FORMAT
  • TEXT360
  • TEXTFORM
  • Donald Knuth’s TeX (appears available but not installed on D6.0A

I may come back to these in a future post.

Further information

As always, MTS Volume 1 has a good introduction to getting printed output.

MTS Volume 15 has more information on TEXT360 and FORMAT.


← Previous  Next →