PreviousNextIndex

INPUT FROM statement

Specifies the new input source for a stream.

Syntax

INPUT [ STREAM stream| STREAM-HANDLE handle ] FROM 
  {     opsys-file 
     |  opsys-device 
     |  TERMINAL 
     |  VALUE ( expression ) 
     |  OS-DIR ( directory ) [ NO-ATTR-LIST ] 
  } 
  [ LOB-DIR { constant | VALUE ( expression ) } ]  
  [ BINARY ] 
  [ ECHO | NO-ECHO ]  
  [ MAP protermcap-entry | NO-MAP ] 
  [ UNBUFFERED ]  
  [     NO-CONVERT  
     |  { CONVERT 
            [ TARGET target-codepage ]  
            [ SOURCE source-codepage ] 
        } 
  ] 

STREAM stream
STREAM-HANDLE handle
opsys-file
opsys-device
TERMINAL
VALUE ( expression )
OS-DIR (directory)
NO-ATTR-LIST
LOB-DIR { constant | VALUE ( expression ) }
BINARY
ECHO
NO-ECHO
MAP protermcap-entry | NO-MAP
UNBUFFERED
CONVERT
TARGET target-codepage
SOURCE target-codepage
NO-CONVERT
Example

Instead of getting input from the terminal, this procedure gets input from a file named r-in.dat. The SEARCH function determines the full pathname of this file.

r-in.p
INPUT FROM VALUE(SEARCH("r-in.dat")). 
REPEAT: 
  PROMPT-FOR Customer.CustNum Customer.CreditLimit. 
  FIND Customer USING INPUT Customer.CustNum. 
  ASSIGN Customer.CreditLimit. 
END. 
INPUT CLOSE. 

This is what the contents of the r-in.dat file look like:

1 55800 
2 41300 
5 88000 

The PROMPT-FOR statement uses the first data item (1) as the CustNum and the second data item (55800) as the CreditLimit. The FIND statement finds the customer whose CustNum is 1 and assigns the value of 55800 as that Customer’s credit limit. On the next iteration of the REPEAT block, the PROMPT-FOR statement uses the value of 2 as the CustNum, the value of 41300 as the CreditLimit, etc.

The INPUT CLOSE statement closes the input source, resetting it to the terminal. When you run this procedure, the data in the window is simply an echo of the data that the procedure is reading from the taxno.dat file. If you do not want to display the data, add the word NO-ECHO to the end of the INPUT FROM statement.

Notes
See also

DEFINE STREAM statement, INPUT CLOSE statement, INPUT THROUGH statement, Stream object handle


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex