Execute different actions based on the table count

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Thanks. I will try that logic.

I tried the 'UtilityRunJob' utility, I am stuck with the %ParamsAssignments% of the syntax.

Syntax : UtilityRunJob(%JobName%, %ParamsAssignments%, %RowLimit%, %WarnLimit%)

The job which UtilityRunJob is calling has 4 parameters & all are assigned values using Environment variables at job level. So I used the syntax UtilityRunJob(%JobName%, 0, 0, 0). But it doesn't seem to accept '0' as the parameter.

Please suggest on the same.

Thanks,
dxk9
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

If the default parameters are OK, then you can put the empty string '' (two single quotes) as the parameter assignment, in place of zero. Otherwise you'll need to put a string instead containing a pipe-delimited parameter list. I suggest you search the server job forum on the UtilityRunJob for examples.

Likewise, you need a string in place of %jobname%, surrounded by quotes.

As suggested in my previous post, this example is from actual working code (all quotes you see are single quotes here). This example calls Job_A with no parameter list, so if Job_A has parameters, then it will run using the default parameter values.

Code: Select all

UtilityRunJob('Job_A', '', 0, 0)
Choose a job you love, and you will never have to work a day in your life. - Confucius
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Thanks qt_ky. It worked !!!

Can you please help me how to use UtilityRunJob to call DSSendMail directly. For eg., If I want to send a mail to xyz@gmail.com and the contents should be 'We don't have any records'.

I searched the forum, but couldn't find the way to call DSSendMail via UtilityRunJob.


Thanks,
dxk9
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

You're welcome.

UtilityRunJob is for calling DataStage jobs.

DSSendMail is a routine for sending email.

You would not use one to call the other directly.

Indirectly, you could have a sequence job with the Notification Activity stage to send your email, and use UtilityRunJob to call that sequence job, but that's a long way to go about this.

Try putting the call to the DSSendMail routine in place of the appropriate UtilityRunJob call.

Search the server job developer's guide and the forum here for examples of DSSendMail parameters in case you need help on the syntax.
Last edited by qt_ky on Thu Dec 22, 2011 9:36 pm, edited 1 time in total.
Choose a job you love, and you will never have to work a day in your life. - Confucius
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Thanks for the clarification.

I will try DSSendMail routine in place of UtilityRunJob.


Thanks,
dxk
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Also as a best practice, avoid hard-coding any email addresses into jobs. Use a project level environment variable or parameter instead. If you need details on that, search, and then I suggest you start it as a new, separate topic.
Choose a job you love, and you will never have to work a day in your life. - Confucius
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Hi,

I am not able to call DSSendMail directly in the transformer. Can you please let me know the routine to call the DSSendMail.


Thanks,
dxk9
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need a wrapper. Take a look at the example routines. or something like:

Code: Select all

FUNCTION MySendMail(aRecipient, aSubject, aBody, aAttachments)
vServer = "MyEmailServer"
vSender = "MyEmail@MyHost.com"
vString = vServer : @FM : vSender : @FM : aRecipient : ...
Call DSSendMail(vString)
Ans = 0
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply