Kalpana Kalpana (Editor)

IBM Machine Code Printer Control Characters

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Early mainframe printers were so called line printers. Line printers provided only a very limited set of commands to control how the paper was advanced when print lines were printed. The application writing reports, list, etc. to be printed had to include those commands in the print data. These single character print commands are called printer control characters.

Contents

Introduction into Print Control Characters

Printer control characters and Carriage control characters are IBM mainframe terms that denote the special meaning which the first character on a line of printable text may have. The first character of each line of text is interpreted as a control character or printer command instead of a character to be printed if a corresponding attribute is set for the print data set (data set is mainframe speak for what is known as a file on other operating systems).

How Printer Control Characters work

While replaced by an electronic version later on, line printers initially used a piece of looped physical paper punch tape to control the movement of the paper while printing. This tape is called a carriage control tape and was mounted on the printer. The length of the carriage control tape had to be exactly the same at the length of one sheet of paper. The looped carriage tape was moved synchronously with the stream of endless paper.

The line printers had 12 sensors to recognize 12 independent positions on the carriage control tape. Each position was called a channel, numbered from 1 to 12. If a hole was punched for a channel, then this hole marked a position that the printer could 'jump to' quickly by advancing until the hole was sensed by the corresponding channel sensor. This is called skip to channel number n.

Commands were implemented so that each of the 12 channels could be jumped to. So instead of having to write empty print lines, applications could simply jump to a predefined channel if nothing was to be written between the current position and the target position. A huge performance gain at that time.

In addition to those skip to channel commands, there are a few more commands that command the printer could interpret to either stay at the current line or to space one, two, or three lines. By staying on the current line, one could create:

  • bold text by rewriting the same text two or three times on the same line. More ink was put on the paper by this repeated printing which lead to kind of bold text appearance.
  • underlined text by writing underline characters at the desired positions after writing the text to be underlined.
  • struck through text by writing dash characters at the desired positions after writing the text to be struck through.
  • Special Meaning of Channel 1

    By convention the position on a sheet of paper where the first print line has to be written was associated with Channel 1. For example, if the first line of text had to always be on physical line 3 for a given form, then the channel 1 hole had to be punched in line 3 of the carriage control tape.

    By convention, IBM mainframe applications always jump to channel 1 when beginning a new logical page.

    Types of Printer Control Characters

    Print data sets on IBM mainframe operating systems may have either of two variants of printer control characters:

  • ASA control characters, see ASA carriage control characters.
  • IBM Machine control characters. Described in this article.
  • The attribute for specifying the presence of print control characters is part of the Record Format (aka RECFM) attribute must therefore allow for two variants:

  • RECFM=..A specifies that the data set contains ASA control characters.
  • RECFM=..M specifies that the data set contains IBM machine control characters.
  • ASA Control Characters

    ASA control characters are logical printer commands. They tell the printer how far to advance the paper before printing the current line of text. ASA control characters are all displayable characters. Printers do not understand these characters themselves, therefore the printer driver must translate them to the corresponding printer commands when sending the print data to the printer.

    IBM Machine Control Characters

    Machine control characters, in contrast, are the very commands which IBM line printers understand. This is why they are hardware dependent or hardware determined. IBM defined this set of commands for their line printers and made sure all their line printers understand them. Other (mainframe) line printer manufacturers also had to make sure their printers understood those commands. Since machine control characters are hardware commands, many of them are not displayable characters and therefore machine control characters are always specified as hexadecimal values.

    Main difference between ASA and Machine Control Characters

    The main difference between the two sets of printer control characters might be the portability of ASA control characters versus the hardware dependency of machine control characters.

    List of IBM Machine Print Control Characters

    IBM defined two sets of printer commands, and therefore two sets of printer control characters are available. The first set of commands did not send any data to be printed to the printer but only a paper movement instruction. These are called immediate commands. The second set of commands send data to be printed on the current line plus a paper movement instruction to the printer. Note that in contrast to the ASA control characters, the IBM machine print control characters ask the printer to firstly print the data on the current line, and then secondly advance the paper.

    Immediate commands

    These commands do not send any data to the printer. The commands only ask the printer to advance the paper.

    Write and Space Commands

    Write and space commands ask the printer to write the data on the line and afterwards move the paper.

    References

    IBM Machine Code Printer Control Characters Wikipedia