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.


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.


comments powered by Disqus