Right Function
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
Right Function
Hi,
I have a column by name Policy Number of data type char and length 15.
The input data for that column varies.
I want my ouput to be length 9.
In the transformer
I am using Right("000000000000000":Trim(Policy Number),9)
But i am getting only last 2 digits instead of 9 digits.
I tried with one record 31256145
My output should be 031256145
But I am getting 45.
Can anybody help me out.
Thanks,
I have a column by name Policy Number of data type char and length 15.
The input data for that column varies.
I want my ouput to be length 9.
In the transformer
I am using Right("000000000000000":Trim(Policy Number),9)
But i am getting only last 2 digits instead of 9 digits.
I tried with one record 31256145
My output should be 031256145
But I am getting 45.
Can anybody help me out.
Thanks,
Rajesh Kumar
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
I tested the same logic(trim) and it works just fine. Hence I think the field is right padded with other character than space.
Can you check whats the APT_STRING_PADCHAR defined in environment variable, also please add a derivied column in transformer and do seq(In.PolicyNumber) and let us know the result in that column.
Also, I have seen some problem with char data type read with ODBC connector stage, hence let us know the version of datastage, source (database/flat file) and stage used to read data.
Can you check whats the APT_STRING_PADCHAR defined in environment variable, also please add a derivied column in transformer and do seq(In.PolicyNumber) and let us know the result in that column.
Also, I have seen some problem with char data type read with ODBC connector stage, hence let us know the version of datastage, source (database/flat file) and stage used to read data.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.![Wink :wink:](./images/smilies/icon_wink.gif)
Genius may have its limitations, but stupidity is not thus handicapped.
![Wink :wink:](./images/smilies/icon_wink.gif)
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
Hi,priyadarshikunal wrote:I tested the same logic(trim) and it works just fine. Hence I think the field is right padded with other character than space.
Can you check whats the APT_STRING_PADCHAR defined in environment variable, also please add a derivied column in transformer and do seq(In.PolicyNumber) and let us know the result in that column.
Also, I have seen some problem with char data type read with ODBC connector stage, hence let us know the version of datastage, source (database/flat file) and stage used to read data.
Its not right padded with any space. I also thought the same thing but did not find any spaces after the record.
I am reading from dataset and loading into another dataset.
I am just reading one column, doing this transformation and loading that column into another dataset
I will try to use this environmental variable and i will let you know.
Thanks,
Rajesh Kumar
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
-
- Participant
- Posts: 19
- Joined: Mon Feb 14, 2005 11:34 pm
Re: Right Function
How frequently the length of column is changing? I mean check distinct column length.
-
- Participant
- Posts: 19
- Joined: Mon Feb 14, 2005 11:34 pm
Re: Right Function
Right function usually trims the fields. Try this out.
Create a vaiable with logic something like this.
If the lenght(Column)=7 then '00':Column else....
use same logic for other lengths as well
Create a vaiable with logic something like this.
If the lenght(Column)=7 then '00':Column else....
use same logic for other lengths as well