Hi,
I'm trying to create batch job which will go and check the status of jobs in particular categoty and email seperately or a common mail for all the jobs failed in category , The below code works and send seperate email if any job is aborted or finished with warnings
***************************************************
cmd="SELECT NAME FMT '60R' FROM DS_JOBS WHERE CATEGORY LIKE '%Chartfields\Fin_To_EPM\Server' ;"
Call DSExecute("UV",cmd,output,sysretcode)
Call DSLogInfo("Command Is: ":cmd,"Batch Job")
Call DSLogInfo("Output from the command: ":output,"Batch Job")
Final=""
n=DCount(output,@FM)
output=EReplace(output,Char(10),"")
For i=1 To n Step 1
A=Field(output,@FM,i)
JobName=Trim(A)
hJob1 = DSAttachJob(JobName, DSJ.ERRNONE)
Status = DSGetJobInfo( hJob1, DSJ.JOBSTATUS)
If
Status.RUNFAILED Or Status = DSJS.CRASHED OR Status = DSJS.RUNWARN
Then
Call DSExecute("UNIX",'/usr/bin/mailx -s hJob1 "a@yahoo.com"','0','0')
End
Next i
******************************************
Regards,
Munish
Dynamic Job name as Email subject
Moderators: chulett, rschirm, roy
Isn't this the same issue as your other post?
Your other post at least showed you attempting to use the JobName, here you would send the job handle if it was working correctly. And it's not working because you buried the variable name in a string. You'd need to break the string around it and concatenate the variable in, fixing the quoting mess and your improper DSExecute syntax at the same time:
And then check SystemReturnCode for a non-zero return.
Your other post at least showed you attempting to use the JobName, here you would send the job handle if it was working correctly. And it's not working because you buried the variable name in a string. You'd need to break the string around it and concatenate the variable in, fixing the quoting mess and your improper DSExecute syntax at the same time:
Code: Select all
Call DSExecute("UNIX","/usr/bin/mailx -s ":hJob1:" a@yahoo.com",Output,SystemReturnCode)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks great help its working now.
Thanks again!
[quote="chulett"]Isn't this the same issue as your [url=viewtopic.php?t=113507]other post?[/url] :?
Your other post at least showed you attempting to use the JobName, here you would send the [b]job handle[/b] if it was working correctly. And it's not working because you buried the variable name in a string. You'd need to break the string around it and concatenate the variable in, fixing the quoting mess and your improper DSExecute syntax at the same time:
[code]Call DSExecute("UNIX","/usr/bin/mailx -s ":hJob1:" a@yahoo.com",Output,SystemReturnCode)[/code]
And then check SystemReturnCode for a non-zero return.[/quote]
Thanks again!
[quote="chulett"]Isn't this the same issue as your [url=viewtopic.php?t=113507]other post?[/url] :?
Your other post at least showed you attempting to use the JobName, here you would send the [b]job handle[/b] if it was working correctly. And it's not working because you buried the variable name in a string. You'd need to break the string around it and concatenate the variable in, fixing the quoting mess and your improper DSExecute syntax at the same time:
[code]Call DSExecute("UNIX","/usr/bin/mailx -s ":hJob1:" a@yahoo.com",Output,SystemReturnCode)[/code]
And then check SystemReturnCode for a non-zero return.[/quote]