PreviousNextIndex

OUTPUT THROUGH statement

Identifies a new output destination as the input to a process that the AVM starts.

Syntax

OUTPUT [ STREAM stream | STREAM-HANDLE handle ] THROUGH  
  { program-name | VALUE ( expression ) } 
  [ argument | VALUE ( expression ) ] ... 
  [ ECHO | NO-ECHO ]  
  [ MAP protermcap-entry | NO-MAP ]  
  [ PAGED ] 
  [ PAGE-SIZE { constant | VALUE ( expression ) } ] 
  [ UNBUFFERED ] 
  [     NO-CONVERT 
     |  { CONVERT  
            [ TARGET target-codepage ] 
            [ SOURCE source-codepage ] 
        } 
  ] 

STREAM stream
STREAM-HANDLE handle
program-name
VALUE ( expression )
argument
ECHO
NO-ECHO
MAP protermcap-entry | NO-MAP
PAGED
PAGE-SIZE { constant | VALUE ( expression ) }
UNBUFFERED
CONVERT
TARGET target-codepage
SOURCE target-codepage
NO-CONVERT
Examples

In this example, the Customer names are displayed. This output is sent as input to the UNIX wc (word count) command. The output of wc is directed to the file wcdata using the standard UNIX redirection symbol (>). Finally, the results are displayed as three integers that represent the number of lines, words, and characters that were in the data sent to wc.

r-othru.p
OUTPUT THROUGH wc > wcdata. 
/* Word count UNIX utility */ 
FOR EACH Customer NO-LOCK: 
  DISPLAY Customer.Name WITH NO-LABELS NO-BOX. 
END. 
OUTPUT CLOSE. 
PAUSE 1 NO-MESSAGE. 
UNIX cat wcdata. 
UNIX SILENT rm wcdata. 

The r-othru2.p procedure uses the UNIX crypt program, which accepts lines of data, applies an algorithm based on an encryption key and writes the result to the UNIX standard output stream, that can be directed to a file. The output from the procedure is directed to crypt, which encrypts the customer names based on the password, mypass. The results of the encryption are stored in the ecust file. Then, the AVM decrypts and displays this file.

r-othru2.p
OUTPUT THROUGH crypt mypass > ecust. 
FOR EACH Customer NO-LOCK WHERE Customer.CustNum < 10: 
  DISPLAY Customer.Name WITH NO-LABELS NO-BOX. 
END. 
OUTPUT CLOSE. 
UNIX crypt mypass <ecust. 

Notes
See also

DEFINE STREAM statement, OUTPUT CLOSE statement, OUTPUT TO statement, Stream object handle


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex