PreviousNextIndex

OUTPUT TO statement

Specifies the new output destination for a stream.

Syntax

OUTPUT [ STREAM stream | STREAM-HANDLE handle ] TO 
  {     PRINTER [ printer-name ] 
     |  opsys-file 
     |  opsys-device 
     |  TERMINAL 
     |  VALUE ( expression ) 
     |  "CLIPBOARD" 
  }  
  [ LOB-DIR { constant | VALUE ( expression ) } ]  
  [ NUM-COPIES { constant | VALUE ( expression ) } ] 
  [ COLLATE ] 
  [ LANDSCAPE | PORTRAIT ] 
  [ APPEND ] 
  [ BINARY ] 
  [ ECHO | NO-ECHO ] 
  [ KEEP-MESSAGES ]  
  [ NO-MAP | MAP protermcap-entry ] 
  [ PAGED ] 
  [ PAGE-SIZE { constant | VALUE ( expression ) } ] 
  [ UNBUFFERED ] 
  [     NO-CONVERT 
     |  { CONVERT 
            [ TARGET target-codepage ] 
            [ SOURCE source-codepage ] 
        } 
  ] 

STREAM stream
STREAM-HANDLE handle
PRINTER [ printer-name ]
opsys-file
opsys-device
TERMINAL
VALUE ( expression )
"CLIPBOARD"(graphical interfaces only)
LOB-DIR { constant | VALUE ( expression ) }
NUM-COPIES { constant | VALUE ( expression ) }
COLLATE
LANDSCAPE
PORTRAIT
APPEND
BINARY
ECHO
NO-ECHO
KEEP-MESSAGES
MAP protermcap-entry | NO-MAP
PAGED
PAGE-SIZE { constant | VALUE ( expression ) }
UNBUFFERED
CONVERT
TARGET target-codepage
SOURCE target-codepage
NO-CONVERT
Examples

The r-out.p procedure sends Customer data to a file. The OUTPUT TO statement directs subsequent output to a file, so all statements that normally send output to the terminal send output to that file. After all the Customer data has been displayed to the file, the OUTPUT CLOSE statement resets the output destination to its previous state, usually the terminal. The final DISPLAY statement displays Finished on the terminal because that is the new output destination.

r-out.p
OUTPUT TO cust.dat. 
FOR EACH Customer NO-LOCK: 
  DISPLAY Customer.CustNum Customer.Name Customer.Address Customer.Address2 
    Customer.City Customer.State Customer.Country SKIP(2) 
    WITH 1 COLUMN SIDE-LABELS. 
END. 
OUTPUT CLOSE. 
DISPLAY "Finished". 

The r-termpg.p procedure sends Customer data to the terminal. The OUTPUT TO TERMINAL PAGED statement directs output to the terminal in a paged format; all statements send output to the terminal one page at a time.

r-termpg.p
DEFINE VARIABLE ix AS INTEGER NO-UNDO. 
OUTPUT TO TERMINAL PAGED. 
FOR EACH Customer NO-LOCK BREAK BY Customer.SalesRep: 
  FIND SalesRep OF Customer NO-LOCK. 
  FORM HEADER TODAY 
    "Customer Listing For " TO 43 
    "Page " TO 55 PAGE-NUMBER - ix  TO 58 FORMAT "99" 
    (SalesRep.RepName) FORMAT "x(30)" AT 25 
    WITH FRAME hdr PAGE-TOP CENTERED. 
  VIEW FRAME hdr. 
  DISPLAY Customer.CustNum COLUMN-LABEL "Customer!Number" 
    Customer.Name LABEL "Name" 
    Customer.Phone COLUMN-LABEL "Phone!Number" WITH CENTERED. 
  IF LAST-OF(Customer.SalesRep) THEN DO: 
    ix = PAGE-NUMBER. 
    PAGE. 
  END. 
END. /* FOR EACH Customer */ 
OUTPUT CLOSE. 

Notes
See also

CLIPBOARD system handle, DEFINE STREAM statement, INPUT-OUTPUT CLOSE statement, PAGE-SIZE function, SESSION system handle, Stream object handle, SYSTEM-DIALOG PRINTER-SETUP statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex