The Background:
I have a need to convert invalid data to {Null} throughout my project. My intention is to develop and maintain a single DSRoutine instead of coding the logic into Transformer derivations as required.
My data is full of '_' values, entered as a default by the source system when no valid record is available. I also have less frequent instances of '' (empty string; length=0) and {Null}. Whenever my input has these values I want to make the output a {Null}.
I intend to call the routine inside the Transformer derivation via:
Code: Select all
FuncNullReplace(DSLink1.COLUMN)
Code: Select all
char* TrxNullReplace(char* Arg11)
{
char* retValue ;
retValue = NULL;
if (*Arg11 != *retValue)
if (*Arg11 != '_')
if (*Arg11 != ' ')
if (*Arg11 != '?')
retValue = Arg11;
return retValue;
}
1) When I pass an empty string or {Null} to this routine, my job aborts with the error:
Code: Select all
Transformer_1,0: Operator terminated abnormally: received signal SIGSEGV
2) If I keep the empty strings out of the routine via an IF statement and only send records with a value to the routine, I cannot get the routine to return a {Null} value to DataStage - ironically, it returns an empty string!
Does anyone has any advice on how to achieve my desired effect? If possible I want to control the processing in one place and reduce the impact of later changes, rather than code data type transformations in each derivation...