PRINT

PRINT

Top  Previous  Next

 

The PRINT statement outputs data to a print unit.

 

 

Format

 

PRINT {NO.ENCODING} {ON print.unit} {print.list}

 

where

 

print.unitidentifies the print unit to which output is to be directed. If omitted, print unit zero is used.

 

print.listis a list of items to print in the format described for the DISPLAY statement.

 

 

The data is output to the requested print unit. Print unit -1 is always associated with the display and cannot be changed. Print unit 0 can be switched between the display and the printer by use of the PRINTER statement. Print units 1 to 255 direct their output to the hold file by default but can be redirected using the SETPTR command.

 

The NO.ENCODING option suppresses encoding when the terminal or printer is set to use an encoding such as UTF-8. It is useful when the data to be output has already be encoded.

 

By using PRINT statements instead of DISPLAY in programs it is possible to select whether the output is directed to the display or to a printer. The LPTR option to the RUN command is equivalent to a PRINTER ON at the start of the program.

 

Use of the @(x,y) cursor movement function in a PRINT statement that sends output to the display will disable pagination. See DISPLAY for more details.

 

Example

 

N = DCOUNT(LINE, @FM)

FOR I = 1 TO N

  PRINT ON PU LINE<I>

NEXT I

PAGE ON PU

 

This program fragment emits each field of LINE to the print unit identified by PU and then advances to a new page.