Routine Activity-Triggers

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
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Routine Activity-Triggers

Post by PRIYARAJ »

Hi

I have a custom routine for dateconversion. When I run the sequence -
ExecuteCommand Activity-Routine Activity-Execute command Activity.I am calling my routine in Routine Activity.

It works fine when I trigger to Unconditional Expression type.But routine does not work when I give Ok condition Trigger.

The warning I get is:

@GetExpirationDate): Routine DSU.GetExpirationDate did not finish OK, return code = '20072412'

Thanks!
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Routine Activity-Triggers

Post by gateleys »

That's because your function 'GetExpirtationDate' returns the date string '20072412'. Any function that returns a non-zero value is NOT considered to have finished successfully.
gateleys
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Re: Routine Activity-Triggers

Post by PRIYARAJ »

What to do to make my job work?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Search the forums for "did not finish OK" and you'll find this has been asked and answered many times over.
-craig

"You can never have too many knives" -- Logan Nine Fingers
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Routine Activity-Triggers

Post by gateleys »

PRIYARAJ wrote:What to do to make my job work?
Assuming that your routine is to be considered successful if it returns a date in the format YYYYDDMM, then you can use the following trigger in your RoutineActivity to the next command stage-

Len(YourRoutineActivityStageName.$ReturnValue) = 8
or
YourRoutineActivityStageName.$ReturnValue > 100

You can have one more trigger ... set to 'Otherwise' where you may handle your exception (This is triggered if the return value of the routine is not of length 8 or value may be -1 ... that is routine failed).
gateleys
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

Post by vcannadevula »

You can also use UserVariables activity instead of Routine Activity stage.You can achieve the same logic and shouldn't receive any warnings
vc
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

vcannadevula wrote:You can also use UserVariables activity instead of Routine Activity stage.
This may not neccessarily be true since we have not yet seen the complexity of the OP's routine. If it is simple and can be handled by a single expression, then yes, you can use the UserVariable stage. However, if that is not the case, then you have to use the RoutineActivity stage.
gateleys
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thank you for your replies !

I tried the trigger which gateleys posted.The job worked fine but gives the warning.When I unchecked the option Log Warnings after activities that finish with status other than ok in Job properties,the sequence runs without any warning.

Also,I will try using UserVariable Activity & let you know.

Thanks !
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

PRIYARAJ wrote: I tried the trigger which gateleys posted.The job worked fine but gives the warning.
What is the warning this time? I hope you have not checked 'Automatically handle activities that fail' in your job sequence.
gateleys
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

I get the same warning as previous one when I use your trigger.I havn't checked that option.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

Oops!! Do not check the 'Log Warnings after activities.....' box, since the routine returns other than 0, it will assume it finish with status other than OK.
gateleys
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Yes,I have unchecked ' Log Warnings after activities.....' & it works fine.

Thanks ! :)
Post Reply