I am working on a script that is based on the parm will generate a DDL using db2look. Problem I am having is I do not want anything showing up on the screen while db2look is running.
I have found a solution, but it makes no sence to me what so ever. here is where I am looking out for you folks to help me understand why it is doing what it is doing.
Here is what I am getting:
1. Running db2look piping it out to a file
Quote:
db2look -d dbname -z schema -t ADVISE_INDEX -e -nofed -noview > x
-- No userid was specified, db2look tries to use Environment variable USER
-- USER is: mmmmmm
-- Specified SCHEMA is: schema
-- The db2look utility will consider only the specified tables
-- Creating DDL for table(s)
Return code for this command is 0
|
DDL Information going to a file, lines with '--' are going to my screen.
2. Now I am going to try to send std out to a file and not a screen
Quote:
db2look -d dbname -z schema -t ADVISE_INDEX -e -nofed -noview > x 1>xx
-- No userid was specified, db2look tries to use Environment variable USER
-- USER is: mmmmmm
-- Specified SCHEMA is: schema
-- The db2look utility will consider only the specified tables
-- Creating DDL for table(s)
Return code is still a 0
|
However, as expected my x file is empty and all of the info is in the xx file. But garbage still went to the screen.
3. My fingers did their own walking and wrote this
Quote:
db2look -d fctdbp -z uszaqk3 -t ADVISE_INDEX -e -nofed -noview >x 2>xx
Return code is still a 0
|
This gave me exactly what I need. DDL into a file, garbage in a dumpster.
Here is where my dilemma. Why all those lines with '--' are treated as an error While return code is still a BIG FAT ZERO? I would have never guessed it.
BTW. I am going to run sed command to clean up garbage file and then run a check on it. If it is empty, then there were no errors, if it is not empty...well, you guessed.
Thank you and remember. It is Friday and it is 5pm someplace.

But don't ignore my question
