I have a small doubt. Please help
My source file has a col A (datatype varchar(12)) and I want to populate target col B (Datatype Smallint) with the logic that if the col A is zero then col B = 1
Now the concern is that as the source col A is having length as 12, I can get anything from 1 zero to 12 zeros in my source file (i.e. 0, 00, 000, ...... , 000000000000).
I don't want to get into checking 12 if clauses here. Can anyone please suggest a smarter way to do this in the transformer stage of Datastage 8.5
Check zeros in transformer Stage
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 730
- Joined: Tue Nov 04, 2008 10:14 am
- Location: Bangalore
1) Use Trim to strip off '0' and then check for blank
2) Convert Col A to integer and then check if its zero
you can add IsValid if you have the appetite for it
Code: Select all
If Trim(A,'0','A')='' Then 1 else <What ever>
Code: Select all
If AsInteger(A)=0 then 1 else <What ever>
- Zulfi
Hi zulfi,
here whats the use by giving of third parametre 'A'
Thanks
Code: Select all
If Trim(A,'0','A')='' Then 1 else <What ever>
Thanks
A-Removes all occurrences of character
For more information you can refer this link
http://publib.boulder.ibm.com/infocente ... ction.html
For more information you can refer this link
http://publib.boulder.ibm.com/infocente ... ction.html