Printer Exits

If a printer exit is specified in the logical printer definition, control is passed to this exit at print time for each record to be printed. Here you can insert, modify or suppress records.

Usually a printer exit is used to insert escape sequences, so that the printer can select special print styles.

As in the examples PRCANON and PRKYOCER in the library SYSNOMS, this could be an escape sequence at the beginning of the printout to switch to landscape mode.

Ideally, the printout should contain mnemonics for all kinds of print attributes (highlighting, underscoring, etc.) which are translated into escape sequences depending on the physical printer to be used. In this way, the printout is independent of any physical printer type.


Printer Exit Interface

Parameter Format/Length Description
PRT-RC  B2 Return code to be set by the exit:

0 = No modification
4 = Record was modified
8 = Record to be inserted
12 = Record to be suppressed
97 = Do not call the exit again until the next report separator start. On the next call, the exit PRT-WORK will be reset.
98 = Stop printing immediately.
99 = Do not call the exit again, but carry on printing.
n = All other codes are reserved for future use.

When a report is printed, 97 and 99 have the same effect.

PRT-RECORD  A251 The record to be printed.
PRT-RECNO  P7 The current record number.
PRT-FLAG  A1 Flag with the following meaning:

F = First record,
M = in the Middle of the printout,
L = Last record.

PRT-WORK  A250 Work area for the printer exit.
PRT-REPORT  A25 The name of the report being printed.
PRT-BUNDLE  A25 The name of the bundle being printed.
PRT-RECFM  A3 The record format of the printout.