OUTPUT TO and the default stream

A stream is a path for data movement. In this case, a stream is a path for output to a named destination. Every ABL procedure has one unnamed default output stream that writes data to the screen. The OUTPUT TO statement is your tool for redirecting the default stream to another destination. Once you use OUTPUT TO to change the output destination in a procedure, the output goes to that destination until you close it with the OUTPUT CLOSE statement, or until you name a new output destination.

This is a partial syntax for the OUTPUT TO statement:

Syntax

OUTPUT [ STREAM stream | STREAM-HANDLE handle ] 
  TO { PRINTER | opsys-file | opsys-device }
  [ PAGED ]

Here is a partial syntax for the OUTPUT CLOSE statement:

Syntax

OUTPUT [ STREAM stream | STREAM-HANDLE handle ] CLOSE

The following table describes the OUTPUT statement syntax components.

Table 1. OUTPUT statement options
Component Description
STREAM Specifies a named output stream. Omit when using the default stream.
STREAM-HANDLE Specifies the handle to a named output stream. Omit when using the default stream.
PRINTER Specifies the default printer as set by your environment.
opsys-file Specifies a legal file name enclosed in quotes for a text file.
opsys-device Specifies a legal device name from your environment enclosed in quotes.
PAGED Directs the AVM to break the output into pages. The AVM sends a page break control character after every 56 lines. Without this option, the AVM sends output in a continuous stream. This option is most often used with printed reports, especially where page headers and footers are used (covered later).