RowProcCompareWithPreviousValue Routine not working...
Moderators: chulett, rschirm, roy
RowProcCompareWithPreviousValue Routine not working...
We are using this routine in a job where we concatenate three fields and check for the previous value of the same three fields. This one is not working at times...But If we use stage variable method it works.
Is there any restrictions on the length of charecters we pass into this routine ?
Appreciate your help...
Is there any restrictions on the length of charecters we pass into this routine ?
Appreciate your help...
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
"Not Working" meaning that the function does not find the difference between two rows even though they are different.
Example :
Row1 : 01223ret236792476r4yr80r84ry4y
Row2 : 01223ret236792476r4yr80r84ry4Z
I was expecting that this routine would say these are different as the last charecter differs. But Routine says that they are same. It appears that it did not check the last charecter and thats why I was asking if there is any restrictions on the length.
Thanks
Example :
Row1 : 01223ret236792476r4yr80r84ry4y
Row2 : 01223ret236792476r4yr80r84ry4Z
I was expecting that this routine would say these are different as the last charecter differs. But Routine says that they are same. It appears that it did not check the last charecter and thats why I was asking if there is any restrictions on the length.
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The logic in the routine should work.
Just for interest, though, take a copy of the routine and replace the above logic with the following.
Code: Select all
If NewValue = LastValue Then
Ans = 1
End Else
Ans = 0
LastValue = NewValue
End
Code: Select all
If Compare(LastValue, NewValue, "L") = 0 Then
Ans = 1
End Else
Ans = 0
LastValue = NewValue
End
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Comparison operators such as "=" must make decisions about whether the operands are numeric or not, so as to perform the correct type of comparison (string or numeric). The third argument of Compare() - the "justification" argument - allows this to be forced. The following code ought also to work.
Code: Select all
If "X" : NewValue = "X" :LastValue Then
Ans = 1
End Else
Ans = 0
LastValue = NewValue
End
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.
I know what you've said before, simply saying it again doesn't help.kaps wrote:Craig - This routine works till 29 char. If the input is 30 chars it does not work.
My question was about row buffering, something you didn't answer. And the routine works fine for me - I just build a quick test job passing it strings from 20 to over 60 characters in length and all comparisons were correct regardless of length. This with 7.5.1a on an HP-UX server, so unless they borked it in 8.x or for your operating system, I'd still guess it is related to how you are using it, not with the routine itself.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers