Error Flag

Post Reply
gaurav.shetti
Posts: 119
Joined: Fri Feb 27, 2009 9:09 am

Error Flag

Post by gaurav.shetti »

Just a small question.
I have a pro*C which takes in a dynamic query and connects to oracle, fetches the data and then prints the o/p
When an error is detected these are the lines of code there
EXEC SQL WHENEVER SQLERROR CONTINUE;

printf("\nORACLE error detected:");
printf("\n% .70s \n", sqlca.sqlerrm.sqlerrmc);

EXEC SQL ROLLBACK WORK RELEASE;
exit(EXIT_FAILURE);


There is a vortex script which calls this pro*C

Now when i give in a wrong query ... (the table doesnt exist, i gave in the wrong table name), and then pass it to this pro*C from vortex script

The Err flag is not set
Instead $ret.oerr is set as "118 <EXEC> command sh returned exit code 1"

My question is .. why isnt the error flag $err and $errnum not being set here.

Isnt this an error?
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Error Flag

Post by mark »

For <exec> use $ret.exitcode to get the program's exit code.

$errnum is only set within <putmsg>. I'm not sure where you got $err.
gaurav.shetti
Posts: 119
Joined: Fri Feb 27, 2009 9:09 am

Error Flag

Post by gaurav.shetti »

Yeah that was the question .. I dont get $err set. Maybe you are right
But then what are the different values of $ret.exitcode that will tell me whether it was a success or a failure or just a warning.
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Error Flag

Post by mark »

$ret.exitcode is what your execed program sets. See the code or documentation of that program to know what the different values mean.
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Error Flag

Post by John »

I.e. $ret.exitcode should correspond to EXIT_FAILURE from the call to exit() in pro*C, which from the message looks like it is 1.
John Turnbull
Thunderstone Software
Post Reply