Throw warning from DS Server custom Routine

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
satish_valavala
Participant
Posts: 123
Joined: Wed May 18, 2005 7:41 am
Location: USA

Throw warning from DS Server custom Routine

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

Post by ray.wurlod »

Code: Select all

Call DSLogWarn(Message_Text, Routine_Name)
Refer to on-line help for full details.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
satish_valavala
Participant
Posts: 123
Joined: Wed May 18, 2005 7:41 am
Location: USA

Post by satish_valavala »

Thanks Ray
Regards
VS
satish_valavala
Participant
Posts: 123
Joined: Wed May 18, 2005 7:41 am
Location: USA

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

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
satish_valavala
Participant
Posts: 123
Joined: Wed May 18, 2005 7:41 am
Location: USA

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

Post by chulett »

And those compile errors would be... ?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply