Command Line E-mail / DSExecute

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Command Line E-mail / DSExecute

Post by admin »

Hi folks. Thanks for the pointers getting a Job Control set up to send e-mail when a job aborts. Im VERY close to having it to work the way I want, but Im still having a little bit of trouble. I downloaded a command line mailer that does exactly what I want it to do (in this case, "Postie")....that is, when I run it from the command line. When I execute it using the DSExecute subroutine in the NT environment, I have mixed results. The problem Im having is that no matter what combination of (for lack of a better phrase) sting container characters (i.e. " or or ) I use, I cannot get more than the first word of the string to be sent in the e-mail (note that Postie will send only the first word of a string if you do not use quotation marks around the text from the command line...Ive tested).

Its as if the double-quote characters are being stripped from the command by the DSExecute routine before the command is being executed. Has anyone else had a similar problem, and if so, how was it handled?

Below is a sample of the Job Control routine that Ive created...notice how I have "MailSubject" and "MailMessage" set up. It doesnt work. Ive tried every combination of the above mentioned characters I can think of. Any suggestions?

* Setup FTPTest, run it, wait for it to finish, and test for success

hJob1 = DSAttachJob("FTPTest", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Failed: FTPTest", "JobControl")
Abort
End
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
MailHost= -host:ourhosename
MailTo= -to:Scott.Conder@ivyhill-wms.com
MailSubject= -s:"DataStage Error"
MailMessage= -msg:"FTPTest job Aborted!"
MailCommand="postie -high ":MailHost:MailTo:MailFrom:MailSubject:MailMessage

* Execute the mail routine

OutPut=""
SysRetCode=""
Call DSExecute ("NT", MailCommand, OutPut, SysRetCode)

* Fatal Error - No Return

Call DSLogEvent(hJob1, DSLogWarn, "Job Aborted, e-mail sent")
End
Locked