Page 1 of 1

Execute Command Activity in Sequence Job -- return value

Posted: Mon Oct 19, 2009 10:53 pm
by Manu1
Hi All,

I am using an script to delete all the records in all the tables before I load them using my sequence job.So,i have used Execute Command Activity in Sequence Job first.

My requirement is i need to capture the status of my script.If it was not executed properly which means it could not delete all the records in all the tables then it shoud send out a status(return value) and that value has to be captured by my Execute Command Activity.If the return code is != 0 it should not proceed further.

I have used Return value (conditional) = 0 in the trigger but it has not served ny Purpose.i.e,Sequence Job is Proceeding further even the script is not executed Properly.


Could any one help in this regard.
Please let me know if you need any further info.

Posted: Mon Oct 19, 2009 11:36 pm
by chulett
Are you certain you are setting your script's exit status properly? Can you post the log entry from your Execute Command stage - it should show the output and the 'reply', which is the Return Code.

Posted: Mon Oct 19, 2009 11:50 pm
by kiran259
Why not "Before Job Routine" ?

Posted: Tue Oct 20, 2009 12:35 am
by balajisr
How about using "OK" trigger?

Posted: Tue Oct 20, 2009 12:51 am
by SHARAD123
Hi,

Is the individual job completing successfully or finishing with a log in case of an error?

If the individual job exits with a log the job run status can be captured to identify the success of the script.

Posted: Wed Oct 21, 2009 10:29 pm
by Manu1
Hi all,

Thanx a lot for your Prompt reply.My Execute acivity is working fine when I have made a small change to my script.

But,I need some help in sending the exact error in mail (using Notification activity).
As of now In the mail I am getting the status of the Job but not the error(present in the log).
For example,My script (for deleting the records in the tables)has failed while deleting the records due to some problem in the Database.
But,for this I just got a mail saying the Job has failed in the subject (Which I have set).
But,when I actually looked into the error messge in the log file.Following is the Issue.

DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0905N Unsuccessful execution due to resource limit being exceeded.
Resource name = "ASUTIME", limit = "000000000232" CPU seconds ("000002500000"
service units) derived from "SYSIBM.DSNRLST01". SQLSTATE=57014.

My requirement is to have the above error message as the body in the mail.

To,summarize I want to have the error message if a job fails as a part of the body in the mail along with the status of the Job.

Please let me know If I am not clear.

Posted: Wed Oct 21, 2009 11:54 pm
by chulett
Did you try enabling the 'Include job status in email' option? That should pull that error from the log into the email body.

Posted: Thu Oct 22, 2009 3:38 am
by Manu1
chulett wrote:Did you try enabling the 'Include job status in email' option? That should pull that error from the log into the email body. ...
I am getting only the status in the mail when this option was enabled..........not the error.......

Posted: Thu Oct 22, 2009 6:48 am
by chulett
Can you post an example, please? In earlier versions, you got a simple status from any successful jobs but the last entry was always the failure point and included something from the job's log from what I recall. :?

If that truly does not work for you, you'll not be able to use the stage but will instead need to script or build a routine to call 'sendmail' or your email client of choice - that way you'll have full control over what goes where. You have no such control over the 'body text' in the stage other than the option I mentioned.