Need to execute more than one After-job Subroutine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Sara
Premium Member
Premium Member
Posts: 3
Joined: Tue Jul 24, 2007 12:36 pm
Location: Ohio

Need to execute more than one After-job Subroutine

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Pavan_Yelugula
Premium Member
Premium Member
Posts: 133
Joined: Tue Nov 23, 2004 11:24 pm
Location: India

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sara
Premium Member
Premium Member
Posts: 3
Joined: Tue Jul 24, 2007 12:36 pm
Location: Ohio

Need to execute more than one After-job Subroutine

Post 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
Post Reply