flags to suppress column output, # of rows selected in db2 sql in UNIX

Hello,

I am new to db2 SQL in unix so bear with me while I try to explain the situation. I have a text file that has the contents of the where condition that I am using for a db2 SQL in UNIX ksh.
Here is the snippet.

if [ -s /entH/temp/VALUE$$.out ];
         then
            echo "Begin processing VALUEs"
            db2 connect to testdb2 user username using passwd
            while read line
            do
                echo "Processing VALUE $line"
                snrf=$(echo $line | awk -F "." '{print $1}')
                db2 "select document_name, document_type, timestamp_date, loc_code, box_number_from from edv.evctr1 where transaction_id = ${VALUE}" >> /entH/temp/${VALUE}_control_data.$$
                echo "EOF1" >> /entH/temp/${VALUE}_control_data.$$
                db2 "select comments from edv.evcmt1 where transaction_id = ${VALUE}" >> /entH/temp/${VALUE}_control_data.$$
            done < /entH/temp/VALUE$$.out
fi

When executed I get several output files for each record selected from the two tables. The general content of each of the output files include the following

document_name  document_type, timestamp_date, loc_code, ...
-------------  -------------  --------------  -------------   ...
col1_value1    col2_value1    col3_value1     col4_value1     ...

   1 record(s) selected.

EOF1

comments
------------------------------------------
comment_value1
comment_value2
comment_value3

   3 record(s) selected.

The question: Is there any flags that can be set while using db2 sql commands from a script to suppress printing of the column names, number of records returned, fix the size of the output records written to the flat files and be able to set inidividual column size of for each column specified in the sql statement?
For instance in oracle you can use something like, set heading off, set feedback off, set linesize 200, COL column_name format format_specifier etc.

If there are flags that can be set, how can I incorporate it in a shell script or is there a ini file that needs to be used?
Any help provided is greatly appreciated. Many thanks.
Jerardfjay :rolleyes: :slight_smile:

For those of you who are interested.
Use the command line option -x to suppress printing of column headers and feedback from the SQL engine other than the desired data output.

Courtesy of IBM web site. More information can be found here.

DB2 - UDB command line options

Jerardfjay :slight_smile: