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 mostly replaced by an electronic versions later on, line printers initially used a loop of punchedSpecial Meaning of ''Channel 1''
By convention the position on a sheet of paper where the first print line has to be written is associated with ''Channel 1''. For example, if the first line of text has to always be on physical line 3 for a given form, then the channel 1 hole has 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 hardware 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. The fact that the ASA controls were ''space before write'', while the machine controls were ''space after write'' could require some data streams to be converted.Language support for printer control
Many programming languages simply place the desired control character in the first byte of the line to be printed.COBOL
COBOL uses the syntaxWRITE record-name AFTER ADVANCING n Lines.
, where ''record-name'' is the name of the area containing the line and ''n'' is the number of lines. Additionally BEFORE ADVANCING
can be used or BEFORE, AFTER ADVANCING TOP
to skip to the top of a new page.
PL/I
PL/I uses the syntaxPUT SKIP(n) ...
to skip ''n'' lines before printing, or PUT PAGE ...
to skip to a new page.
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.See also
* ASA carriage control characters * Line Printer * Carriage control tape * Data set (IBM mainframe)References