I just want to create a simple routine that should run my Job,If the Job failed the error should be logged! Can any one help me out in solving my Problem. I tried writing routines through some examples.But it throws errors
Here is the sample routine,,, Can anyone correct me where i am wrong!!
Hjob1 = DSAttachJob("test1",DSJ.ERRFATAL)
Dummy = DSSetParam(Hjob1,"Param1","Value1")
Dummy = DSRunJob(Hjob1,DSJ.RUNNORMAL)
J1stat = DSGetJobInfo(Hjob1, DSJ.JOBSTATUS)
If J1stat = DSJS.RUNFAILED
Then Call DSLogFatal("Job DailyJob1 failed","JobControl")
End
To Run a Job thro Routines
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 81
- Joined: Wed Jul 14, 2004 3:18 am
- Location: Johannesburg, South Africa
- Contact:
Why write something when it can be written for you?
In designer, go to Job Properties, Job Control tab, drop down the box and select the job you want to generate code for, and click Add Job.
You can of course use the generated code as a template and modify it to your needs.
In designer, go to Job Properties, Job Control tab, drop down the box and select the job you want to generate code for, and click Add Job.
You can of course use the generated code as a template and modify it to your needs.
Morney le Roux
There are only 10 kinds of people: Those who understand binary and those who don't.
There are only 10 kinds of people: Those who understand binary and those who don't.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Error checking!!!
You didn't check whether the job was attached successfully, and you didn't check whether DSSetParam succeeded. You (like way too many others) blithely assumed that all would be well, and proceeded to issue a run request. And, as Craig pointed out, you didn't wait for the job to complete before checking its status; when you checked its status was either "starting" or "running".
How do you know the job failed? Do you know that DSJS.RUNFAILED actually means? Is it the same? Are you aware that there are other possibilities (such as DSJS.CRASHED) that your code does not handle?
I have a number of areas of concern with the automatically generated code. which could be improved greatly. It's better than it used to be, but there's a lot more that could be done. Code generated by compiling a Job Sequence is better, in that it retains control (does not abort) but it, too, could be improved.
You didn't check whether the job was attached successfully, and you didn't check whether DSSetParam succeeded. You (like way too many others) blithely assumed that all would be well, and proceeded to issue a run request. And, as Craig pointed out, you didn't wait for the job to complete before checking its status; when you checked its status was either "starting" or "running".
How do you know the job failed? Do you know that DSJS.RUNFAILED actually means? Is it the same? Are you aware that there are other possibilities (such as DSJS.CRASHED) that your code does not handle?
I have a number of areas of concern with the automatically generated code. which could be improved greatly. It's better than it used to be, but there's a lot more that could be done. Code generated by compiling a Job Sequence is better, in that it retains control (does not abort) but it, too, could be improved.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.