PRINTER Statement
Selects either the terminal or the system printer for subsequent program output.
Syntax
PRINTER [ON || OFF || CLOSE]
Comments
The PRINTER ON statement directs subsequent program output to the system printer.
The PRINTER OFF statement directs subsequent program output to the terminal.
The PRINTER CLOSE statement causes all data currently stored in the spooler to be printed immediately.
Operation
When a PRINTER ON statement is issued, program output data (specified by subsequent PRINT, HEADING, FOOTING or PAGE statements) is not printed immediately, unless immediate printing is forced via an SP-ASSIGN command with option I or N specified. Instead, the data is stored in the spooler and printed when the program terminates, or when a PRINTER CLOSE statement is issued.
Once executed, a PRINTER ON or a PRINTER OFF statement remains in effect until another PRINTER (ON or OFF) statement is executed. If neither a PRINTER OFF nor a PRINTER ON statement has been executed, output is to the user's terminal.
PRINTER CLOSE applies only to output directed to the line printer.
Examples
PRINTER ON
PRINT A
PRINTER OFF
PRINT B
Displays value of variable B on the terminal immediately. The value of variable A is printed when the program ends.
PRINTER ON
PRINT A
PRINTER CLOSE
PRINTER OFF
PRINT B
Prints value of variable A immediately. Value of variable B is then displayed on the terminal.