Page 1 of 1

Standalone Routine to send mail !

Posted: Tue Apr 22, 2008 1:50 am
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

Posted: Tue Apr 22, 2008 3:43 am
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.

Standalone Routine to Send mail !

Posted: Tue Apr 22, 2008 6:34 am
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

Posted: Tue Apr 22, 2008 6:54 am
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.