Hi
I have a string length of 288 characters.
I have some conditions like if position in string[122,125] = 'xyz'
then statement 1 else statement 2.
my question is can we sue incolumn.[122,125] tp return string
at this position.
thks
position string
Moderators: chulett, rschirm, roy
You will always get back a string, unless the value is a NULL, you'll get a NULL. If the value is shorter in length than your position, you will get blank (you know quote-quote ""). Since you're using it in an If-Then-Else, you need to consider handling the NULL condition, which you're not.
You're also not insuring only 3 characters are returned because 122,125 means 125 characters returned. If the string is shorter than that, you won't get any padded characters. But, if there's extra values then you'll never get just "xyz".
Consider:
You're also not insuring only 3 characters are returned because 122,125 means 125 characters returned. If the string is shorter than that, you won't get any padded characters. But, if there's extra values then you'll never get just "xyz".
Consider:
Code: Select all
If ISNULL(string) Then NullResult Else If string[125,1] # "" Then TooLongResult Else If string[122,3]="xyz" Then ThatResult Else DefaultResult
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Hi,
You may also use any DS basic function like Num() to determine if the string you got is numeric.
IHTH,
What ken said is that you can use link.col[122,3] to extract the 122nd - 125th characters of any string (if they exist) then you can compare that string using the If ... Then ... Else syntax to apply your logic.sainath wrote:hi
Thanks for your quick reply .
This string cannot be null.
my quesition
position string[123 through 125] including decimals is numeric or ='n/a'
then return the string .
how can me do in datastage.
thks
You may also use any DS basic function like Num() to determine if the string you got is numeric.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
![Image](http://www.worldcommunitygrid.org/images/logo.gif)
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
![Image](http://www.worldcommunitygrid.org/images/logo.gif)
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
<pedantry>
Character positions 122 through 125 total four characters. Therefore the second argument to substring needs to be 4.
And this will never be equal to "xyz" - a three character string can never be equal to a four character string.
</pedantry>
Character positions 122 through 125 total four characters. Therefore the second argument to substring needs to be 4.
And this will never be equal to "xyz" - a three character string can never be equal to a four character string.
</pedantry>
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.