OUTPUT THROUGH statement
Identifies a new output destination as the input to a process that the AVM starts.
Syntax
STREAMstream
The name of a stream. If you do not name a stream, the AVM uses the unnamed stream. See the DEFINE STREAM statement reference entry and the chapter on alternate I/O sources in OpenEdge Development: Programming Interfaces for more information on streams.STREAM-HANDLEhandle
Specifies the handle to a stream. Ifhandle
it is not a valid handle to a stream, the AVM generates a run-time error. Note that stream handles are not valid for the unnamed streams. See the chapter on alternate I/O sources in OpenEdge Development: Programming Interfaces for more information on streams and stream handles.program-name
VALUE (expression
)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 the AVM from using that argument as one of the PAGED, PAGE-SIZE, ECHO, NO-ECHO, or UNBUFFERED options for the OUTPUT THROUGH statement.ECHONO-ECHOMAPprotermcap-entry
| NO-MAP
Theprotermcap-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). The AVM uses the PROTERMCAP entries to build a translation table for the stream. Use NO-MAP to make the AVM bypass character translation altogether. See OpenEdge Deployment: Managing ABL Applications for more information on PROTERMCAP. See OpenEdge Development: Internationalizing Applications for more information on national language support.PAGEDPAGE-SIZE {constant
| VALUE (expression
) }
Specifies the number of lines per page. Theexpression
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 ABL UNIX statement) and your ABL output (with the OUTPUT THROUGH statement). That is, the OUTPUT THROUGH statement manages the buffering of output between the ABL procedure the UNIX program that it invokes, but it does not handle the buffering of output to any other programs that the ABL procedure might also invoke.CONVERT
Allows you to modify the character conversions occurring between the UNIX program and ABL. 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 SOURCEsource-codepage
alone, the conversion acceptssource-codepage
as the code page name used in the AVM memory (instead of -cpinternal).If you specify TARGETtarget-codepage
, the conversion acceptstarget-codepage
as the code page of the UNIX program (instead of -cpstream).If you specify both SOURCEsource-codepage
and TARGETtarget-codepage
, it converts characters from thesource-codepage
totarget-codepage
(instead of -cpinternal to -cpstream).TARGETtarget-codepage
SOURCEtarget-codepage
NO-CONVERTExamplesIn this example, the Customer names are displayed. This output is sent as input to the UNIX
wc
(word count) command. The output ofwc
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 towc
.
The
r-othru2.p
procedure uses the UNIXcrypt
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 tocrypt
, 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.
Notes
- When you use the OUTPUT CLOSE statement to close an output destination used by an OUTPUT THROUGH statement, the AVM closes the pipe, waits one second, and then continues.
- For any character conversions to occur, all of the necessary conversion tables must appear in
convmap.cp
(a binary file that contains all of the tables that ABL uses for character management).- If you specify a value of “undefined” for either
source-codepage
ortarget-codepage
, no character conversion is performed.- For more information on output destinations, see OpenEdge Development: Programming Interfaces.
See alsoDEFINE STREAM statement, OUTPUT CLOSE statement, OUTPUT TO statement, Stream object handle
OpenEdge Release 10.2B
|