I'm trying to write a function that accepts a type and performs an SQL request based on the value. In the case that an invalid value is passed to the function I would like to print an error message and end the job rather than send a mangled SQL to the DB.
On the left side of the Implementation tab of the Function properties is a (I assume comprehensive) list of the syntax possibilities within this language. The Exit() function seems to be exactly what I'm looking for but when I run the job it is simply ignored. The System() call directly afterwards is still called and the job runs successfully.
Are there maybe specific code values that I need to pass to Exit() in order for it to end execution of the job?
if TYPE NOT IN ('CHR','NUM','AMT','TS','D')
then begin
System(concat('echo ERROR: Invalid TYPE passed to READ_VAR: ', TYPE));
Exit(-1);
System('echo Why am I able to read this?');
end
else begin
<SQL REQUEST>
end
Edit: Forgot an apostrophe.
Why are you trying to do this all in one node? Couldn't you set a variable based on the results of your test then use a condition node afterwards to look at the variable contents and either proceed with an SQL node or else link to a procedure node displaying a message that has no successors in the stream?
Just a thought.
MF.
It's not a node, it's a function that is being called by the variable initialization of many DS Jobs.
I think I've found my problem.
Apparently the Exit() function has no meaning outside of builds (http://publib.boulder.ibm.com/infocenter/cbi/v10r1m0/index.jsp?topic=%2Fcom.ibm.swg.im.cognos.fnct_ds.10.1.0.doc%2Ffnct_ds_id1780Exit.html).
Which explains why it's not working. As far as I can tell though there is no comparable function that exists at the Job level. So I guess I'm just going to have to rethink my solution entirely.