Page 1 of 1

Need to execute more than one After-job Subroutine

Posted: Tue Jul 24, 2007 1:19 pm
by Sara
I would like to know if there is any way I can execute 2 after-job subroutines in one job. I have a bunch of stand-alone jobs that do not require sequencers. They are being triggered by SAP-BW. Currently, these jobs are coded with an after-job subroutine that would read the job statistics. However, because SAP would not send me an email if the job aborts, I need to call DSSendMail as well as an after-job subroutine. I have thought of putting each of these stand alone jobs in their own mini-sequencers so that I can attach a Notification Activity, but that's a bad idea as far as SAP (this is a little too complicated to explain). Would calling a subroutine from the current after-job subroutine be my only option? Any help would be appreciated. Thanks.

Posted: Tue Jul 24, 2007 1:32 pm
by DSguru2B
The routine in which you are collect the job stats, you can incorporate the DSSendMail() routine by checking the INTERIM job status. Use the site's search facility to learn more about the INTERIM job status.

Posted: Tue Jul 24, 2007 1:38 pm
by Pavan_Yelugula
Sara,
How about coding your DSSend mail in the Routine which is already there(The one capturing the Job stats). It is Pretty Simple to add a extra couple of lines in the already existing routine to send a Mail.

I am not a big fan of the Notification Activity because of its limitations.

The Code you need to add in your routine will be roughly like this

ERRCODE = DSSendMail("To:xxx@xx.com\nFrom:DSJobFailure@xx.com\nSubject:xxx\nServer:xxx\nBody:xxxxx\n")


Thanks
Pavan

Posted: Tue Jul 24, 2007 11:50 pm
by ray.wurlod
You can call other subroutines from your own after-job subroutines. Write one that calls the two. You need a "DSU." prefix.

Code: Select all

Call DSU.MyFirstRoutine((InputArg), ErrorCode)
Call DSU.MySecondRoutine((InputArg), ErrorCode)

Need to execute more than one After-job Subroutine

Posted: Thu Jul 26, 2007 9:14 am
by Sara
Thanks to Ray's input, I created a new subroutine that would call the two other existing routines. Using some UNIX commands, I read the xml file that was created in one of the subroutines being called to get the job status. Depending on the status, I will get an email if the job aborts and not if the job finished successfully. It is working perfectly (in test anyway).
Thank you all.
-Sara