Any suggestions on this

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Any suggestions on this

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Replace the 'bang' (exclamation point) with whatever you are using it to mean - like the keyword 'Or' I would guess.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

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

???
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post 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.
Post Reply