Writes values to the specified row set.
WRITE-RS NAME=row_set_name_var|_lit|_col VALUE=({name_var|_lit|_col},{data_var|_lit|_col})
NAME
Name of the row set.
VALUE
Column name and value. Can be repeated as many times as needed to satisfy the row set definition.
WRITE-RS can reside in any section except BEGIN-SETUP, BEGIN-SQL, and BEGIN-DOCUMENT. Validation rules include:
The row set specified by row_set_name must be active, or an exception is thrown.
If NAME is an empty string, then VALUE is ignored.
If NAME is not an empty string, then it must be defined in OPEN-RS.
The data type should match the type specified for the column. If needed, implicit conversions are performed according to SQR rules. If a required conversion cannot be done, an exception is thrown (for example, a numeric value specified for a DATE column).
Based on the row set definition in OPEN-RS, if a column is not specified with a VALUE entry, it is assumed to be a NULL value.
The row set file is an XML file. You can define whether to create the XML file in a BI Publisher (BIP) format or an SQR format in the FormatForRowsetXML entry in the [Default-Settings] section of SQR.INI.
Begin-Report
Open-RS Name='customer' FileName='customer.xml'
Column = ('cust_num', 'integer')
Column = ('name', 'string')
Column = ('addr1', 'string')
Column = ('addr2', 'string')
Column = ('city', 'string')
Column = ('state', 'string')
Column = ('zip', 'string')
Column = ('phone', 'string')
Column = ('tot', 'integer')
Begin-Select
cust_num
name
addr1
addr2
city
state
zip
phone
tot
Write-RS Name='customer'
Value = ('cust_num', $cust_num)
Value = ('name', &name)
Value = ('addr1', &addr1)
Value = ('addr2', &addr2)
Value = ('city', &addr3)
Value = ('state', &addr4)
Value = ('zip', &zip)
Value = ('phone', &phone)
Value = ('tot', $&tot)
from customers
order by cust_num
End-Select
Close-RS Name='customer'
End-Report