PRINTER FILE

PRINTER FILE

Top  Previous  Next

 

The PRINTER FILE statement directs printer output to a named record in a directory file.

 

 

Format

 

PRINTER FILE {ON print.unit} file.name, record.name

{ON ERROR statement(s)}

{THEN statement(s)}

{ELSE statement(s)}

 

where

 

print.unit evaluates to the print unit on which the action is be to performed. If omitted, the default print unit (unit 0) is used.

 

file.nameevaluates to the VOC name of an existing directory file.

 

record.nameevaluates to the name of the record within file.name to which output to print.unit is to be directed. If the record already exists, it will be overwritten.

 

statement(s)are statements to be executed depending on the outcome of the operation.

 

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. Reopening the print unit without changing the destination will overwrite the same record.

 

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.