![]() ![]()
|
INPUT THROUGH statement
Uses the output from a program as the input to an ABL procedure.
Syntax
STREAMstream
Specifies the name of a stream. If you do not name a stream, the unnamed stream is used. See the DEFINE STREAM statement reference entry and OpenEdge Development: Programming Interfaces for more information on streams.STREAM-HANDLEhandle
Specifies the handle to a stream. Ifhandleit 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-nameVALUE (expression)argument
Represents an argument you want to pass to the UNIX program. INPUT THROUGH passes thisargumentas a character string.If theargumentis the literal value echo, no-echo, or unbuffered, enclose it in quotes to prevent the AVM from interpreting that argument as one of the ECHO, NO-ECHO, or UNBUFFERED options for the INPUT THROUGH statement.ECHONO-ECHOMAPprotermcap-entry| NO-MAP
Theprotermcap-entryvalue is an entry from the PROTERMCAP file. Use MAP to read an input stream that uses a different character translation from the current stream. Typically,protermcap-entryis 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.UNBUFFEREDCONVERT
Allows you to modify the character conversions occurring between the UNIX program and ABL. By default, the INPUT THROUGH statement converts characters from the code page specified with the Stream Code Page (-cpstream) parameter to the code page specified with the Internal Code Page (-cpinternal) parameter. If you specify SOURCEsource-codepagealone, the conversion acceptssource-codepageas the code page name of the UNIX program (instead of -cpstream). If you specify TARGETtarget-codepage, the conversion acceptstarget-codepageas the internal code page (instead of -cpinternal). If you specify both SOURCEsource-codepageand TARGETtarget-codepage, it converts characters from thesource-codepagetotarget-codepage(instead of -cpstream to -cpinternal).TARGETtarget-codepageSOURCEtarget-codepageNO-CONVERTExamplesThis procedure uses as its input source the output of the UNIX
echocommand. Before the command runs, the UNIX shell substitutes the process-id number for $$ and the current directory search path for $PATH. The results are then echoed and become available as a line of input to ABL. When the IMPORT statement is executed, the line of input from echo is read and the values are assigned to the two variables. Those variables can then be used for any purpose. In this example, the wordechomust be lowercase and the word$PATHmust be uppercase, since they both pass to UNIX:
When you use INPUT THROUGH, the UNIX program you name is executed as a separate process under its own shell. Therefore, the values of shell variables (such as $$) are values from that shell rather than the shell from which the AVM executes.
The following procedure uses INPUT THROUGH twice to get input from the UNIX
pwdandlscommands. Thepwdcommand supplies the name of the current directory and thelscommand supplies the name of each UNIX file in your current directory. After the variablefnis set, it displays on the screen.
Notes
- INPUT THROUGH specifies the source for subsequent statements that process input. It does not read any data from the source.
- To use the IMPORT, INSERT, PROMPT-FOR, SET, or UPDATE statement, the AVM puts the data in the frame fields referenced in these statements, and if ECHO is in effect, the frame is output to the current output destination. If you use the NO-ECHO option, then the frame is not output. If a subsequent DISPLAY statement causes the frame to display, the input data also displays.
- When INPUT THROUGH is closed, the pipe to the UNIX process is also closed.
- 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-codepageortarget-codepage, no character conversion is performed.See alsoDEFINE STREAM statement, INPUT CLOSE statement, INPUT FROM statement, Stream object handle
![]() |
OpenEdge Release 10.2B
|
![]() ![]()
|