Return Value from the 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
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Return Value from the routine...

Post by meena »

Hi All,
I have requirement where I need to send an email based on the record count of the file. If record count is 2 then I need to send an email...I am using below routine for word count of the file...While testing the routine the output is 2 but when I am using this routine in the sequencer with trigger return value=2, for the trigger link to email notification....it is not working...

Code: Select all

InputArg=" cat /artl/Ascential/DataStage/Projects/Development/":ARG1:"|wc -l" 

   Call DSExecute("UNIX", InputArg, Output, SystemReturnCode) 
   
   Ans= Output 
   ReturnValue=Ans 
How can I do this?I do not want to use UNIX script.....

Thanks in Advance...
Aruna Evoori
nick.bond
Charter Member
Charter Member
Posts: 230
Joined: Thu Jan 15, 2004 12:00 pm
Location: London

Post by nick.bond »

Is the job aborting?

If so in the job properties uncheck the option "Automatically handle activities that fail"

When a routine returns anything other than 0, DS thinks it is a return code other than 0 so it thinks the routine has aborted. When you are using routines to return values you need to code your own error handling and turn of the automatic stuff.

If you already have the set correctly but the link is not being entered can you post your condition statement.
Regards,

Nick.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Output from DSExecute is a dynamic array, so there's more than just your 'line count' there even though you can't see it. You need to remove it before you make your comparison. Try making this change to your routine:

Code: Select all

Ans = Output<1>
-or-

Code: Select all

Ans = Convert(@FM,"",Output)
One of the two should fix you up. Remove the 'ReturnValue=Ans' line (if it is an actual lline of code) as it's not needed. Once you have the routine working, everything Nick said will come into play in your Sequence job with the Routine Activity stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Thank you Nick & Craig..

The routine is working with a change from Ans=Output to Ans=Output<1>
Aruna Evoori
Post Reply