PRINTER FILE |
![]() ![]() ![]() |
The PRINTER FILE statement associates a file with a print unit.
Format
PRINTER FILE {ON print.unit} file.name, record.name {ON ERROR statement(s)} {THEN statement(s)} {ELSE statement(s)}
where
The ON ERROR, THEN and ELSE clauses are all optional.
Output to print units 1 to 255 is directed to a hold file by default but can be redirected. The PRINTER FILE statement causes the named record to be created and output will be directed to this file until the print unit is closed.
The ON ERROR clause is executed in the event of a fatal internal error while attempting to open the file. The error code returned by the STATUS() function will indicate the cause of the error. If this clause is omitted, the program will abort in the event of a fatal error.
The THEN clause is executed if the operation is successful. The STATUS() function will return zero.
The ELSE clause is executed if the file cannot be opened. The error code returned by the STATUS() function will indicate the cause of the error. If this clause is omitted, program execution continues after an error.
Example
PRINTER FILE ON 1 "MYFILE", "SAVED"
This statement directs output from print unit 1 to record SAVED in directory file MYFILE. |