Progress
Language Reference


OUTPUT THROUGH Statement

Interfaces
OS
SpeedScript
All
NT, UNIX only
Yes

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

SYNTAX

OUTPUT [ STREAM stream ] 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

The name of a stream. If you do not name a stream, Progress uses the unnamed stream. See the DEFINE STREAM Statement reference entry in this book and the chapter on alternate I/O sources in the Progress Programming Handbook for more information on streams.

program-name

The name of the program to which you are supplying data from a procedure. This can be a standard command or your own program.

VALUE ( expression )

An expression whose value is the name of a UNIX program to which you are supplying data from a procedure.

An expression is also the argument that you want to pass to the UNIX program. OUTPUT THROUGH passes the value of expression as a character string.

argument

An argument you want to pass to the UNIX program. The OUTPUT THROUGH statement passes this argument as a character string.

If the argument is the literal value paged, page-size, echo, no-echo, or unbuffered, you must enclose it in quotes to prevent Progress from using that argument as one of the PAGED, PAGE-SIZE, ECHO, NO-ECHO, or UNBUFFERED options for the OUTPUT THROUGH statement.

ECHO

Sends all input data read from a file to the UNIX program. Progress echoes data by default.

NO-ECHO

Suppresses the echoing of input data to the UNIX program.

MAP protermcap-entry | NO-MAP

The protermcap-entry is an entry from the PROTERMCAP file. Use MAP to send output to a device that requires different character mappings than those in effect for the current output stream. Typically, protermcap-entry is a slash-separated combination of a standard device entry and one or more language-specific add-on entries (MAP laserwriter/french or MAP hp2/spanish/italian, for example). Progress uses the PROTERMCAP entries to build a translation table for the stream. Use NO-MAP to make Progress bypass character translation altogether. See the Progress Client Deployment Guide for more information on PROTERMCAP. See the Progress Internationalization Guide for more information on national language support.

PAGED

Formats the output into pages.

PAGE-SIZE { constant | VALUE ( expression ) }

Specifies the number of lines per page. The expression is a constant, field name, variable name, or expression whose value is an integer. The default number of lines per page is 56. If you use the TERMINAL option to direct output to the terminal, the default number of lines per page is the number of lines of TEXT widgets that fit on the screen. If you specify a non-zero value for PAGE-SIZE, then the PAGED option is assumed. If you specify PAGE-SIZE 0, the output is not paged.

UNBUFFERED

Writes one character at a time to a normally buffered data source, such as a file. Use the UNBUFFERED option only when you can intermingle your UNIX output (with the Progress UNIX statement) and your Progress output (with the OUTPUT THROUGH statement). That is, the OUTPUT THROUGH statement manages the buffering of output between the Progress procedure the UNIX program that it invokes, but it does not handle the buffering of output to any other programs that the Progress procedure might also invoke.

CONVERT

Allows you to modify the character conversions occurring between the UNIX program and Progress. By default, the OUTPUT TO statement converts characters from the code page specified with the Internal Code Page (-cpinternal) parameter to the code page specified with the Stream Code Page (-cpstream) parameter. If you specify SOURCE source-codepage alone, the conversion accepts source-codepage as the code page name used in Progress memory (instead of -cpinternal). If you specify TARGET target-codepage, the conversion accepts target-codepage as the code page of the UNIX program (instead of -cpstream). If you specify both SOURCE source-codepage and TARGET target-codepage, it converts characters from the source-codepage to target-codepage (instead of -cpinternal to -cpstream).

TARGET target-codepage

Specifies the target code page of the character conversion (replacing -cpstream). The name that you specify must be a valid code page name available in the DLC/convmap.cp file (a binary file that contains all of the tables that Progress uses for character management).

SOURCE target-codepage

Specifies the source code page of the character conversion (replacing -cpinternal). The name that you specify must be a valid code page name available in the DLC/convmap.cp file (a binary file that contains all of the tables that Progress uses for character management).

NO-CONVERT

Specifies that no character conversions occur between the external file and Progress. By default, the OUTPUT THROUGH statement converts characters from the -cpinternal code page to the -cpstream code page.

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:
    DISPLAY 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, Progress decrypts and displays this file.

r-othru2.p
OUTPUT THROUGH crypt mypass > ecust.

FOR EACH customer WHERE cust-num < 10:
  DISPLAY 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


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095