Sending the Stop message to DataStage from Unix..

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

kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Sending the Stop message to DataStage from Unix..

Post by kaps »

Hi

I am executing a shell script from Routine Activity sequence. When the shell scripts fails I am exiting with a non-zero value(say '88') which creates a warning message on the DataStage job log. I would like to get the FATAL error instead of Warning Message in the logs ? How can I do that ?

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

Post by chulett »

Link to another Routine Activity stage that calls UtilityAbortToLog.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Craig,

Thanks for the quick reply. I have done it like this. Just want to make sure is thats what you meant...

Routine1 ---> Routine2

In Routine1's trigger I am using custom(conditional) and expression as DSJS.RUNWARN.

In Routine2 I am calling UtilityAborttoLog and Arg1 as DSJS.RUNWARN.

It works...But looks like I am stating the samething twice...Is this the correct approach ?

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

Post by DSguru2B »

Nop. You are not. You are aborting the sequence job when you encounter a warning in your routine. Arg1 can be anything. Its a log entry from your end.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

OK...If I am not doing the right thing can you tell me what should be the correct way of doing this.

I have tried the following in custom value of the Routine1 but it's not aborting the job.

RA_Fld_Lvl_Change.$ReturnValue="88"

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

Post by DSguru2B »

kaps wrote:It works...But looks like I am stating the samething twice...Is this the correct approach ?

Thanks
That "No. You are not" was for the above quest of yours. You are fine.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Oops...I got it wrong...Thanks for the clarification...
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

DSGuru,
It's not working...It's Aborting the job even there is no warnings in Routine1...
How can check using the return value of the Routine ?

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

Post by chulett »

I was wondering when you were going to figure that out. :wink:

What trigger are you using? Still this?
kaps wrote:In Routine1's trigger I am using custom(conditional) and expression as DSJS.RUNWARN.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Alternativley you can 'Abort' the routine based on the ReturnCode as well.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Craig - Yes. I am using the samething...

"In Routine1's trigger - custom(conditional) and expression as DSJS.RUNWARN"

Kumar - I tried ReturnValue. It does not work...Is ReturnCode different from ReturnValue ?

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

Post by chulett »

A Custom trigger expects an Expression there, something that evaluates to true or false. You know, like "X = 1" or some such.

Having a singleton value - like DSJS.RUNWARN, which is a "2" by the way - means your expression is just "2". And since a zero is false and a non-zero value is true, that "expression" always evaluates to true. Hence your problem.

For a Routine Activity, all you can check is the $ReturnValue. It doesn't "run ok" or "run warn" like a job, it simply returns a value. Left to its own devices, it interprets a zero return value as 'Ran Ok' and any other value as 'Ran NOT Ok'. So, depending on what values your routine returns, you may need multiple triggers to catch all of the different results. You should be able to get that working if all you want to check is the status your script returns. You have coded it to return the value you were checking for as the exit code, yes, and are not simply echoing them to the screen or some such?

Now, if you ran that shell script via the Execute Command stage, then you've got another option on what you can check - $CommandOutput, whatever the command sends to standard out would be captured there.

This gets even more complicated if you've got the 'Automatically handle activities that fail' option turned on in the Sequence job. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,
You are using DSExecute("UNIX",Command, Result, SystemReturnCode), Aren't you?
Use DSLogInfo to see what is the Result and SystemReturnCode, and change your code accordingly.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

chulett wrote:I was wondering when you were going to figure that out. :wink:

What trigger are you using? Still this?
kaps wrote:In Routine1's trigger I am using custom(conditional) and expression as DSJS.RUNWARN.
Completely overlooked that. I guess I was more concerned with your question of using it twice rather than what you are using. Sorry kaps.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Kumar - I am not using DSExecute. I am using ExecShSilent in Routine Activity of Sequence job and giving the script name in InputArg.

Where do you want me to use DSExecute ?

Thanks
Post Reply