Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
MIKE MAGIE — — source: IIUG Forums & Mailing Lists
All -
Help me out here. In a simple ksh script I am doing this:
#!/usr/bin/ksh
SERVER=training
DBNAME=test_db
TABLE=tab1
dbaccess ${DBNAME}@${SERVER} - << EOT!
drop table ${TABLE};
EOT!
When the script runs it produces the following:
informix@kcsun45/users/jmagie/COOL_SCRIPTS/RESIZE>mike.sh
Database selected.
242: Could not open database table (informix.tab2).113: ISAM error: the file is locked.
Error in line 1Near character position 18
Database closed.
Which is very cool and what I want it to produce. (yes tab1 is not locked - I
am playing with FK-PK stuff).
My question is how can I within the script check for the occurence of the -113
error? If I add the following line after the dbaccess part:
dbaccess ${DBNAME}@${SERVER} - << EOT!
drop table ${TABLE};
EOT!
RET=$?
echo $RET
I get 255 - the generic return code from a failed sql stmt. I'd like to either
be able to redirect all of dbaccess' output into a file and then awk/grep my
way through getting the ISAM code or magically be able to capture the ISAM
code. Does that make sense?
Mike
↪ replying to MIKE MAGIE
MIKE MAGIE — — source: IIUG Forums & Mailing Lists
I figured something out - I can:
dbaccess ${DBNAME}@${SERVER} 2>me.out - << EOT!
And capture the return codes. Yeah me. Nevermind.
MM
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.