base.Channel.read
Reads a list of data delimited by a separator from the channel.
Syntax
read(
[ variableList ] )
RETURNS INTEGER
- variableList is a list of program variables separated by a comma, or record.*
Usage
After opening the channel object, use the read()
method to read
a record of data from the channel.
The read()
method uses the field delimiter defined by
setDelimiter()
.
The read()
method
takes a modifiable list of variables as parameter, by using the [
]
square brace notation.
A call to read()
is blocking until the read operation is complete.
If the read()
method
returns less data than expected, then the remaining variables will
be initialized to NULL. If the read()
method returns
more data than expected, the data is silently ignored.
Any
target variable must have a primitive type (BOOLEAN
, TINYINT
, SMALLINT
, INT
, BIGINT
, SMALLFLOAT
, FLOAT
, DECIMAL
, DATE
, DATETIME
, INTERVAL
, BYTE
, TEXT
, CHAR
, VARCHAR
, STRING
)
or be a RECORD
that contains only primitive members.
If data is read, the read()
method returns TRUE
. Otherwise it returns FALSE
, indicating the end of the
file or stream.
Example
WHILE ch.read([cust_rec.*])
...
END WHILE
For a complete example, see Example 1: Using record-formatted data file.