Hi,
I am new to Routines in DS, i am trying to write a routine which will reset a job and will make it available to run. The routine that i have made is as follows:
h$V0S0 = DSAttachjob(Arg1,DSJ.ERRNONE)
If (h$V0S0) Then
hErrcode = DSRunJob(h$V0S0 , DSJ.RUNRESET )
End
I am getting error as follows:
Compiling: Source = 'DSU_BP/DSU.ResetJob', Object = 'DSU_BP.O/DSU.ResetJob'
Array 'DSAttachjob' never dimensioned.
WARNING: Variable 'DSJ.ERRNONE' never assigned a value.
Array 'DSRunJob' never dimensioned.
WARNING: Variable 'DSJ.RUNRESET' never assigned a value.
WARNING: Variable 'Ans' never assigned a value.
2 Errors detected, No Object Code Produced.
How can i solve this.
Regards,
Rajeev Prabhu
Routine to reset a job
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 136
- Joined: Wed Sep 29, 2004 5:56 am
- Location: Chennai
- Contact:
-
- Participant
- Posts: 85
- Joined: Fri Jun 04, 2004 2:30 am
- Location: Melbourne, Australia
- Contact:
You might want to have a look at the following code. Originally this design came to me on a Datastage BASIC course that Ray Wurlod took (Thanks Ray ):
You will of course have to modify it based on your job (Ie parameters, job name etc).
Code: Select all
**************************************
* Run Job: PocketSportsMasterControl *
**************************************
* Run Job if in runnable state, if not then Reset and Run
hJob = DSAttachJob("PocketSportsMasterControl", DSJ.ERRWARN)
ActualJobName = DSGetJobInfo(hJob, DSJ.JOBNAME)
$IfDef DebugMode
Message = "Actual Job Name ":ActualJobName:"."
Call DSLogInfo(Message, RoutineName)
$EndIf
If ActualJobName <> DSJE.BADHANDLE
Then
$IfDef DebugMode
Message = "Runnable returned :":Runnable(DSGetJobInfo(hJob, DSJ.JOBSTATUS))
Call DSLogInfo(Message, RoutineName)
$EndIf
If Runnable(DSGetJobInfo(hJob, DSJ.JOBSTATUS)) = 'Y'
Then
ErrCode = DSSetParam(hJob, "SrcSvr", SrcSvr)
ErrCode = DSSetParam(hJob, "SrcUser", PSSrcUser)
ErrCode = DSSetParam(hJob, "SrcUserPwd", PSSrcUserPwd)
ErrCode = DSSetParam(hJob, "PublishDate", PublishDate)
ErrCode = DSRunJob(hJob, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob)
Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
Call DSLogWarn("Job Failed: ":ActualJobName:".", RoutineName)
End
End
If Runnable(DSGetJobInfo(hJob, DSJ.JOBSTATUS)) = 'R'
Then
Message = "Job is resetting..."
Call DSLogInfo(Message, RoutineName)
ErrCode = DSRunJob(hJob, DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob)
Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
Message = "Job Reset Failed: ":ActualJobName:"."
Call DSLogWarn(Message, RoutineName)
End
Else
ErrCode = DSDetachJob(hJob)
hJob = DSAttachJob("PocketSportsMasterControl", DSJ.ERRWARN)
Message = "Job has been reset, Running Job..."
Call DSLogInfo(Message, RoutineName)
ErrCode = DSSetParam(hJob, "SrcSvr", SrcSvr)
ErrCode = DSSetParam(hJob, "SrcUser", PSSrcUser)
ErrCode = DSSetParam(hJob, "SrcUserPwd", PSSrcUserPwd)
ErrCode = DSSetParam(hJob, "PublishDate", PublishDate)
ErrCode = DSRunJob(hJob, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob)
Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
Call DSLogWarn("Job Failed (After auto-reset): ":ActualJobName:".", RoutineName)
End
End
End
End ; * ActualJobName Loop
Else
Message = 'Job ':ActualJobName:' not found in this project.'
Call DSLogWarn(Message, RoutineName)
End
* Detach current job handle to re-use
ErrCode = DSDetachJob(hJob)
Cheers,
Dave Nemirovsky
Dave Nemirovsky
-
- Participant
- Posts: 136
- Joined: Wed Sep 29, 2004 5:56 am
- Location: Chennai
- Contact:
Hi,
Thank you. We will modify and execute it.
Regards,
Rajeev Prabhu
Thank you. We will modify and execute it.
Regards,
Rajeev Prabhu
djhigh wrote:You might want to have a look at the following code. Originally this design came to me on a Datastage BASIC course that Ray Wurlod took (Thanks Ray ):
You will of course have to modify it based on your job (Ie parameters, job name etc).Code: Select all
************************************** * Run Job: PocketSportsMasterControl * ************************************** * Run Job if in runnable state, if not then Reset and Run hJob = DSAttachJob("PocketSportsMasterControl", DSJ.ERRWARN) ActualJobName = DSGetJobInfo(hJob, DSJ.JOBNAME) $IfDef DebugMode Message = "Actual Job Name ":ActualJobName:"." Call DSLogInfo(Message, RoutineName) $EndIf If ActualJobName <> DSJE.BADHANDLE Then $IfDef DebugMode Message = "Runnable returned :":Runnable(DSGetJobInfo(hJob, DSJ.JOBSTATUS)) Call DSLogInfo(Message, RoutineName) $EndIf If Runnable(DSGetJobInfo(hJob, DSJ.JOBSTATUS)) = 'Y' Then ErrCode = DSSetParam(hJob, "SrcSvr", SrcSvr) ErrCode = DSSetParam(hJob, "SrcUser", PSSrcUser) ErrCode = DSSetParam(hJob, "SrcUserPwd", PSSrcUserPwd) ErrCode = DSSetParam(hJob, "PublishDate", PublishDate) ErrCode = DSRunJob(hJob, DSJ.RUNNORMAL) ErrCode = DSWaitForJob(hJob) Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS) If Status = DSJS.RUNFAILED Then Call DSLogWarn("Job Failed: ":ActualJobName:".", RoutineName) End End If Runnable(DSGetJobInfo(hJob, DSJ.JOBSTATUS)) = 'R' Then Message = "Job is resetting..." Call DSLogInfo(Message, RoutineName) ErrCode = DSRunJob(hJob, DSJ.RUNRESET) ErrCode = DSWaitForJob(hJob) Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS) If Status = DSJS.RUNFAILED Then Message = "Job Reset Failed: ":ActualJobName:"." Call DSLogWarn(Message, RoutineName) End Else ErrCode = DSDetachJob(hJob) hJob = DSAttachJob("PocketSportsMasterControl", DSJ.ERRWARN) Message = "Job has been reset, Running Job..." Call DSLogInfo(Message, RoutineName) ErrCode = DSSetParam(hJob, "SrcSvr", SrcSvr) ErrCode = DSSetParam(hJob, "SrcUser", PSSrcUser) ErrCode = DSSetParam(hJob, "SrcUserPwd", PSSrcUserPwd) ErrCode = DSSetParam(hJob, "PublishDate", PublishDate) ErrCode = DSRunJob(hJob, DSJ.RUNNORMAL) ErrCode = DSWaitForJob(hJob) Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS) If Status = DSJS.RUNFAILED Then Call DSLogWarn("Job Failed (After auto-reset): ":ActualJobName:".", RoutineName) End End End End ; * ActualJobName Loop Else Message = 'Job ':ActualJobName:' not found in this project.' Call DSLogWarn(Message, RoutineName) End * Detach current job handle to re-use ErrCode = DSDetachJob(hJob)
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your original problem was casing. Function names are case sensitive.
The function name you wanted was DSAttachJob. The function name you specified was DSAttachjob. Not the same function.
The function name you wanted was DSAttachJob. The function name you specified was DSAttachjob. Not the same function.
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.
-
- Participant
- Posts: 136
- Joined: Wed Sep 29, 2004 5:56 am
- Location: Chennai
- Contact:
Hi Ray,
Thank you. I added the header file and then changed the j to J it got compliled sucessfully. My first Routine is sucessfull.
Thank you once again.
Regards,
Rajeev Prabhu
Thank you. I added the header file and then changed the j to J it got compliled sucessfully. My first Routine is sucessfull.
Thank you once again.
Regards,
Rajeev Prabhu
ray.wurlod wrote:Your original problem was casing. Function names are case sensitive.
The function name you wanted was DSAttachJob. The function name you specified was DSAttachjob. Not the same function.
-
- Participant
- Posts: 136
- Joined: Wed Sep 29, 2004 5:56 am
- Location: Chennai
- Contact: