Page 1 of 1

Any suggestions on this

Posted: Thu Mar 31, 2005 12:24 pm
by DSguru2B
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

Posted: Thu Mar 31, 2005 12:34 pm
by chulett
Replace the 'bang' (exclamation point) with whatever you are using it to mean - like the keyword 'Or' I would guess.

Posted: Thu Mar 31, 2005 12:40 pm
by mhester
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.

Posted: Thu Mar 31, 2005 12:51 pm
by DSguru2B
Thanks both of youu.
In my table there are 3 values in which manga is not = null and the value 8 is not being still populated.

???

Posted: Thu Mar 31, 2005 1:28 pm
by mhester
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

Posted: Thu Mar 31, 2005 4:40 pm
by ray.wurlod
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.

Posted: Thu Mar 31, 2005 6:38 pm
by vmcburney
Create a debug version of your job and use the Test button to try all combinations. Once it is working remove the debug statements:

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) 
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.