base.Channel.write
Writes a list of data delimited by a separator to the channel.
Syntax
Note: In the next(s) syntax diagram(s), the
[ ] { } |
symbols are part of the syntax.write( valueList )
-
value
-
[ value
, ...
] -
record
-
[ record.* ]
- value is an expression of a primitive
data type such as
INTEGER
,VARCHAR(50)
, etc. - record is a variable defined as a
RECORD
. - When there are multiple values to write, the value(s) must be specified between
[ ]
square brackets. These are provided as a variable parameter list. - If only one value is to be written, you can specify the value without the
[ ]
brackets. - To write all values from a
RECORD
variable, therecord.*
notation can be used when surrounded by[ ]
brackets, to expand all record fields as a list of simple values. Or, you can also directly specify the record name without the.*
notation and no[ ]
brackets.
Usage
After opening a channel, use the write()
method to write a
record of data to the channel.
The write()
method uses the field delimiter defined by setDelimiter()
. The delimiter
also defines serialization rules for example when using "CSV"
.
The write()
method takes a modifiable list of variables as the parameter.
The method raises error -6345 if the channel fails to write data.
Example
DEFINE cust_rec RECORD LIKE customer.*
...
CALL ch.write(cust_rec) -- equivalent to ch.write([cust_rec.*])