UNIX command output not captured using RoutineActivityStage
Posted: Mon Jul 30, 2007 4:10 pm
I am using Routine_activity stage to read a flat file in Parallel extender sequence to pass it to DSSendmail.
Here is the BeforeAfter DSSendmail code I have:
-----------
$INCLUDE DSINCLUDE JOBCONTROL.H
* This is just an interlude to the DSSendMail job control function,
* to allow it to be called as a before/after routine:
Call DSLogInfo(DSMakeMsg("InputArgument for the notification file path ":InputArg, ""), "ChevBeforeAfterSendMail")
UNIXcmd = "head -1 ":InputArg
Call DSLogInfo(DSMakeMsg("unix command used is ":UNIXcmd, ""), "ChevBeforeAfterSendMail")
Call DSExecute("UNIX", UNIXcmd, output, SystemReturnCode)
Call DSLogInfo(DSMakeMsg("Output From the unix command --":output<1>:"--System return=":SystemReturnCode, ""), "ChevBeforeAfterSendMail")
ToAddress<-1> = output<1>
FromAddress<-1> = "abc@abc.com"
Server<-1> = "abc.net"
Subject<-1> = "HI.This is a test. Please ignore"
MessageBody<-1> = "Test. To be ignored"
MailString = "From:":FromAddress:"\nTo:":ToAddress:"\nSubject:":Subject:"\nServer:":Server:"\nBody:":MessageBody
Call DSLogInfo(DSMakeMsg("Mail String used for DSSendMail ":MailString,""), "ChevBeforeAfterSendMail")
MailString_test="From:":FromAddress:"\nTo:snoc@abc.com\nSubject:":Subject:"\nServer:":Server:"\nBody:":MessageBody
* Reply = DSSendMail(MailString)
Reply = DSSendMail(MailString_test)
Begin Case
Case Reply = DSJE.NOERROR
ErrorCode = 0 ;* set to 0 - file checked OK, job continues
Case @True
ErrorCode = 1 ;* some other error, such as bad InputArg, stops the job if this is an after routine
End Case
-----------
The InputArg is the pathname of the file.
This is the error I get in the Director.
-------------
Seq_Notification_List..JobControl (ChevBeforeAfterSendMail): Output From the unix command ----System return=0
-----------
So clearly the output from the DSExecute is not captured.
Interestingly, if I hard code the path of the file instead of passing it as an argument then it works fine.
Can anyone tell me where the problem is ?
Thanks for looking into the problem.
--Sree
Here is the BeforeAfter DSSendmail code I have:
-----------
$INCLUDE DSINCLUDE JOBCONTROL.H
* This is just an interlude to the DSSendMail job control function,
* to allow it to be called as a before/after routine:
Call DSLogInfo(DSMakeMsg("InputArgument for the notification file path ":InputArg, ""), "ChevBeforeAfterSendMail")
UNIXcmd = "head -1 ":InputArg
Call DSLogInfo(DSMakeMsg("unix command used is ":UNIXcmd, ""), "ChevBeforeAfterSendMail")
Call DSExecute("UNIX", UNIXcmd, output, SystemReturnCode)
Call DSLogInfo(DSMakeMsg("Output From the unix command --":output<1>:"--System return=":SystemReturnCode, ""), "ChevBeforeAfterSendMail")
ToAddress<-1> = output<1>
FromAddress<-1> = "abc@abc.com"
Server<-1> = "abc.net"
Subject<-1> = "HI.This is a test. Please ignore"
MessageBody<-1> = "Test. To be ignored"
MailString = "From:":FromAddress:"\nTo:":ToAddress:"\nSubject:":Subject:"\nServer:":Server:"\nBody:":MessageBody
Call DSLogInfo(DSMakeMsg("Mail String used for DSSendMail ":MailString,""), "ChevBeforeAfterSendMail")
MailString_test="From:":FromAddress:"\nTo:snoc@abc.com\nSubject:":Subject:"\nServer:":Server:"\nBody:":MessageBody
* Reply = DSSendMail(MailString)
Reply = DSSendMail(MailString_test)
Begin Case
Case Reply = DSJE.NOERROR
ErrorCode = 0 ;* set to 0 - file checked OK, job continues
Case @True
ErrorCode = 1 ;* some other error, such as bad InputArg, stops the job if this is an after routine
End Case
-----------
The InputArg is the pathname of the file.
This is the error I get in the Director.
-------------
Seq_Notification_List..JobControl (ChevBeforeAfterSendMail): Output From the unix command ----System return=0
-----------
So clearly the output from the DSExecute is not captured.
Interestingly, if I hard code the path of the file instead of passing it as an argument then it works fine.
Can anyone tell me where the problem is ?
Thanks for looking into the problem.
--Sree