Page 1 of 1

Throw warning from DS Server custom Routine

Posted: Wed Jan 18, 2006 6:46 pm
by satish_valavala
How can we throw a warning message from a custom server routine when any of the else condition in a routine fails at job runtime.

Thanks
VS

Posted: Wed Jan 18, 2006 6:53 pm
by ray.wurlod

Code: Select all

Call DSLogWarn(Message_Text, Routine_Name)
Refer to on-line help for full details.

Posted: Wed Jan 18, 2006 8:39 pm
by satish_valavala
Thanks Ray

Posted: Thu Jan 19, 2006 12:52 pm
by satish_valavala
I Tried this in routine, it didn't work.

I have routine named "myroutine(Arg1) , Arg1 is "Code",
I am expecting 'X', 'Y' and 'Z' for Arg1, if any other value comes, I would like to throw a warning from myroutine

Eg:-
code = trim(code)
begin case

case code = 'X'
Ans = 1
case code = 'Y'
Ans = 2
case code = 'Z'
Ans = 3
case @true * (If any other value apperas for code)
Ans = I need to throw a warning at job runtime

end case

I am assigning this routine in the derivation.

Thanks
VS

Posted: Thu Jan 19, 2006 4:15 pm
by ray.wurlod
Just put the call to DSLogWarn within the scope of CASE @TRUE (and make sure that Ans is assigned some value that can be handled by its caller, perhaps @NULL or -1.

Posted: Fri Jan 20, 2006 10:19 am
by satish_valavala
Itried the following routine code, but its throwing compile errors,
Eg:-
code = trim(code)
begin case

case code = 'X'
Ans = 1
case code = 'Y'
Ans = 2
case code = 'Z'
Ans = 3
case @true * (If any other value apperas for code)
Ans = @null
DSLogWarn("Unexpected code appeared":code,"myroutine")

end case

Thanks
VS

Posted: Fri Jan 20, 2006 10:54 am
by chulett
And those compile errors would be... ?

Posted: Fri Jan 20, 2006 7:16 pm
by ray.wurlod
Comment must be a separate statement. See CASE @TRUE line.

Code: Select all

code = trim(code) 
begin case 

case code = 'X' 
Ans = 1 
case code = 'Y' 
Ans = 2 
case code = 'Z' 
Ans = 3 
case @true ; * (If any other value apperas for code) 
Ans = @null 
DSLogWarn("Unexpected code appeared":code,"myroutine") 

end case