I've searched the docs and the forums, but can't find any reference to the problem I'm experiencing:
For the second time, I built a routine that sets Ans = @TRUE or @FALSE, and when I call that routine in a Transformer derivation, the result seems to be ignored. Is there any know problem with passing @TRUE/@FALSE as a result from a routine?
In the routine's test harness, I have a bunch of tests that show the expected result (1 for @TRUE, 0 for @FALSE). But when I test the results in a Transformer derivation, like
Code: Select all
if ( MyRoutine(inputlink.field) ) then 'value_if_true' else 'value_if_false'
the resulting output always follows the ELSE path. Same occurs if I explicitly check for the result, like
Code: Select all
if ( MyRoutine(inputlink.field) = @TRUE ) then 'value_if_true' else 'value_if_false'
I suppose eventually I'll have to set Ans = 1 or 0 instead of @TRUE or @FALSE, but I
hate hard-coding values like that. The code is less readable, and more subject to misinterpretation. We deal with all sorts of code outside DataStage that uses values other than 1 and 0 to represent TRUE and FALSE -- some methods return -1 for an error; Unix utils generally return 0 for success, etc. So I always have to pause and do some mental gymnastics when I see '1' or '0' in code, whereas @TRUE and @FALSE are immediately obvious and self-documenting. Symbolic names are good! Please tell me I'm doing something wrong -- that would be better than a design flaw in DataStage that ignores @TRUE/@FALSE as return values from a routine.
Anyone had this problem? Thanks!