This might be of use to you. :)
A useful application of the RISQL Entry Tool or RISQL Reporter is to extract selected data from a database and place that data into a file for transfer to another program. You can also use a pipe (|) to send row data output directly from the RISQL Entry Tool or RISQL Reporter to another program, such as the Table Management Utility (TMU).
When using the RISQL Entry Tool or RISQL Reporter in data extraction applications, you typically want to restrict data output to only query result rows, omitting the product copyright notice, column headings, blank lines, and so on. Quiet mode restricts output to query results only.
Redirecting extraction results from the shell
You can perform data extractions at the operating-system level directly from the UNIX or Windows shell (for example, in a shell script).
When you perform data extraction from the shell by specifying quiet mode (-q tool-startup option), all nonerror output from the program is redirected to a file or pipe with standard UNIX or Windows file-redirection commands. Using the -q option also changes the default setting of the following statements:
* SET ECHO is set to OFF.
* SET ROW DATA is set to ONLY.
Examples
Use quiet mode (-q command-line option) to extract only query result rows to a file as shown below:
$ risql -q username password < weekly_extract > excel_import
To pipe extracted data to another program, such as the TMU, enter:
$ risql -q username password < weekly_extract | rb_tmu load.tmu
username password
Redirecting extraction results from within the tool
When used together, the following statements capture query results in a file for transfer to another program during a RISQL Entry Tool or RISQL Reporter session:
* SET ROW DATA ONLY causes the query result columns to be returned without column headings or other extraneous information.
* SET ECHO OFF suppresses the RISQL prompt and input commands, as described on Including input in output.
* SET OUTPUT filename sends row data output to a file instead of the terminal (standard output), as described on Saving or discarding output.
Example
To send only the row data for the specified period to a file named weekly_extract, enter:
RISQL> set row data only;
RISQL> set echo off;
RISQL> set output weekly_extract;
RISQL> select *
> from period join sales
> on period.perkey = sales.perkey
and qtr = 'Q1_99';
Exit status codes
The RISQL Entry Tool and RISQL Reporter use the following exit status codes:
Status Code > Meaning
0 > Information or statistics messages might have been issued during execution, but no warning, error, or fatal messages were issued.
1 > Warning messages cause an exit status of 1 to be returned.
2 > Error messages cause an exit status of 2 to be returned.
3 > Fatal messages cause an exit status of 3 to be returned.
The RISQL Entry Tool and RISQL Reporter return the highest status code encountered during processing. For example, if the RISQL Entry Tool generates only informational messages, it will return an exit status code of 0; if, however, it generates both information messages and a fatal message, it will return an exit status code of 3.
Formatting reports
This chapter describes report-formatting features included with the RISQL Reporter. These features are not available with the RISQL Entry Tool.
http://publib.boulder.ibm.com/infocenter/rbhelp/v6r3/index.jsp?topic=/com.ibm.redbrick.doc6.3/risql/risql32.htm
Please post back if you have any more problems or questions.
If this information is useful, please mark as helpful. Thanks.