The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
print selected rows with awk tonet Shell Programming and Scripting 6 09-27-2007 06:23 AM
splitting a column into rows spindoctor UNIX for Dummies Questions & Answers 3 07-24-2007 03:25 PM
return number of rows selected new2ss Shell Programming and Scripting 7 01-08-2007 10:46 AM
Factorize some rows in a column frebo UNIX for Dummies Questions & Answers 5 03-21-2006 06:41 AM
Cutting rows after a selected point nhatch Shell Programming and Scripting 4 09-05-2003 10:14 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-27-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
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.

Code:
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

Code:
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
  #2 (permalink)  
Old 11-02-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
use -x option

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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:21 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0