i have a routine that is working for one condition but not for the other. the piece of code is as follows
RoutineName = 'EkbeAsnQty'
Deffun DSRMessage(A1, A2, A3) Calling "*DataStage*DSR_MESSAGE"
Ans = 0
Mange = 0
IF IsNull(Menge) = 0 Then
IF (Vgabe = '6'! Vgabe = '8' ) THEN
If Shkzg = 'S'! Shkzg='' Then Ans = (Menge * 1) Else If Shkzg = 'H' Then Ans = (Menge * (-1)) Else Ans = 0
End
Else Ans = 0
End
Return(Ans)
the target table is being populated for condition Vgabe = 6, but not for Vgabe = 8....
can anyone tell me why
Any suggestions on this
Moderators: chulett, rschirm, roy
The ! and OR is ok (along with AND and &) - both work.
I copied your program as it is and tested it myself and it works for all combinations where Menge is not null. I suspect that you are either encountering the situation where Menge is null when Vgabe is an 8 or Vgabe is not ever an 8 when Menge is not null.
I copied your program as it is and tested it myself and it works for all combinations where Menge is not null. I suspect that you are either encountering the situation where Menge is null when Vgabe is an 8 or Vgabe is not ever an 8 when Menge is not null.
Mike Hester
mhester@petra-ps.com
mhester@petra-ps.com
If Menge is not null and Vgabe is 8 then what is the value of Shkzg? If this is anything but an "S", "" or "H" then Ans will be 0
Mike Hester
mhester@petra-ps.com
mhester@petra-ps.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You've initialized a variable called Mange but used a variable called Menge in your code, without using Mange anywhere. Do you think this might be affecting what you're trying to do, or even your thought processes?
You did not mention the names of the routine's arguments.
Can you describe in words the desired processing? This may help us to come up with the correct logic, rather than trying to correct your code, which corrections may be based on erroneous assumptions.
You did not mention the names of the routine's arguments.
Can you describe in words the desired processing? This may help us to come up with the correct logic, rather than trying to correct your code, which corrections may be based on erroneous assumptions.
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: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Create a debug version of your job and use the Test button to try all combinations. Once it is working remove the debug statements:
I think the Shkzg='' is a bit dodgy, you may get nulls or ' ' in this field. Clearly you need some developer comments in this routine to tell other developers what is going on.
Code: Select all
RoutineName = 'EkbeAsnQty'
Deffun DSRMessage(A1, A2, A3) Calling "*DataStage*DSR_MESSAGE"
Result = 0
Debug = ""
Mange = 0
IF IsNull(Menge) = 0 Then
Debug='1'
IF (Vgabe = '6'! Vgabe = '8' ) THEN
Debug=Debug:'2'
If Shkzg = 'S'! Shkzg='' Then
Debug=Debug:'3'
Result = (Menge * 1)
Else
Debug=Debug:'4'
If Shkzg = 'H' Then
Debug=Debug:'5'
Result = (Menge * (-1))
End
End
End
Ans = Debug : ' ' : Result
Return(Ans)
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn