Spaces populating as 0 in the first postion in datastage(v8.5)

28 views Asked by At

I am using a condition in transformer to populate space values if two statements gets satisfied. My derivation is as below:

If (Column1=Column2 And Column3='') Then Column4='' Else Column4(It's incoming value) --> So in this condition column3 is having a datatype of Char(50). So, while executing this condition the output of the condition IF statement is getting satisfied as 0 instead of space. Column4 is also having a datatype of Char(50).

Requirement: Column4 should populate same as column3 value if, IF statement is satisfied or else it should populate it's original value coming from source. I am using datastage(v8.5). Also when writing to peek stage and seeing it is coming as 0. Tried all ways of Space(50), " ", ' ' etc.,

please help out on this. let me know if any details needed.

Note: Column3 is read from a dataset file. Suggest on this or let me know if I miss any piece of information in the question.

Thanks in Advance.!!

I have tried all the ways possible but couldn't able to populate spaces in Column4 which is having datatype same as Column3 i.e, Char(50)

1

There are 1 answers

2
keraion On

In your derivation, the Then Column4 = '' is a conditional statement that is asking "Is Column4 equal to empty string?" returning a Boolean value; 0 for False and 1 for True. Since Column4 is a CHAR(50), this will always be '0'.

Instead, you need to return spaces ('', Spaces(50)) in the Then portion of your derivation.

Derivation Column Name
If Column1 = Column2 and Trim(Column3) = '' Then '' Else Column4 Column4

This now will return spaces when your condition (Column1 equals Column2 and Trim(Column3) equals empty string) is true and the original Column4 value when false.