Standalone Routine to send mail !

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

Moderators: chulett, rschirm, roy

Post Reply
chandarun
Participant
Posts: 4
Joined: Thu Apr 03, 2008 11:35 pm

Standalone Routine to send mail !

Post by chandarun »

Hi All,

I am having a requirement in my sequencer wherein I need to send a mail to the desired recepient. The mail has to be in the form of a standlaone routine. I have a routine which rejects records and sends them as mail by taking the required parameters. I am not sure as to where to make changes in this code to make it a standlone routine. Please help me out in this regard. The code for the mail of rejected records is as follows :


#INCLUDE DSINCLUDE JOBCONTROL.H
#INCLUDE DSINCLUDE DSJ_XFUNCS.H

*---- getting Job Name-------------*

* strJobName = DSGetJobInfo(DSJ.ME,DSJ.JOBNAME)
* Call DSLogInfo("Job Name (strJobName) :":strJobName, DSJ.ME)

* strWorking = DSGetParamInfo(DSJ.ME,"$HMK_DIRWORKING", DSJ.PARAMVALUE)
* Call DSLogInfo("Working Directory (strWorking) :":strWorking, DSJ.ME)


*------Getting the Mail Information---------*

* FROM_MAILID = DSGetParamInfo(DSJ.ME, "JPM_FROM_MAILID", DSJ.PARAMVALUE)
* TO_MAILID=DSGetParamInfo(DSJ.ME, "JPM_TO_MAILID", DSJ.PARAMVALUE)
* SUBJECT=DSGetParamInfo(DSJ.ME, "JPM_SUBJECT", DSJ.PARAMVALUE)
* BODY=DSGetParamInfo(DSJ.ME, "JPM_BODY", DSJ.PARAMVALUE)

FROM_MAILID = "JPM_FROM_MAILID"
TO_MAILID="JPM_TO_MAILID"
SUBJECT="Gelco Web Reply File Output"

*-----------Sending Mail If Row Count In the Reject Link is Greater Than 0----------------------------*

CALL DSExecute("UNIX", "cat JPM_DIR_WORKING/xx.txt", ScreenOutput, ReturnCode)

Result= DSSendMail("From:":FROM_MAILID:"\nTo:":TO_MAILID:"\nSubject:":SUBJECT:"\nBody:":ScreenOutput)

ErrorCode = 0 ;

Any Help in this regard will be highly appreciated.

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

Post by ray.wurlod »

What do you mean by "standalone"?

DataStage routines execute only in the DataStage environment. Ultimately they must be invoked from a DataStage job. Even the Test grid writes a small job "on the fly" to invoke the routine under test.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chandarun
Participant
Posts: 4
Joined: Thu Apr 03, 2008 11:35 pm

Standalone Routine to Send mail !

Post by chandarun »

Ray,

The mails could be sent as an afterjob subroutine( Job parameters section) or could be sent as a routine activity in Sequencer. If we place the Routine activity in the sequencer and want to send a sequential file(generated in a job) as e-mail, how would I proceed? Please correct me if I am wrong. Please let me know if i gotto change the order/ add new parameters to the above mentioned code if that is the requirement.

Regards,
Chandru
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Post by sud »

ray.wurlod wrote:What do you mean by "standalone"?
Hi Chandru,

Well, it is difficult to make out exactly what you want.

1> Before/After routine:

Define your routine type as before/after routine and the routine will become a before/after routine.

2> Standalone call from sequence:

This will work by default and you just need to feed the correct parameter values to the routine.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
Post Reply