Page 1 of 1

Problems for Job Control

Posted: Fri May 19, 2006 12:30 pm
by rochaul
I have a Job that one is seting in variable and in one of the two jobs that it is calling for the Job Control. Necessary that before executing same they they are resetados. Please Help me and sorry for my english.

It follows the code below:



* Setup JobExecucao_Bat_Vendas, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("JobExecucao_Bat_Vendas_1", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Failed: JobExecucao_Bat_Vendas_1", "JobControl")
Abort
End
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSSetUserStatus(1)
Call DSLogFatal("Job Failed: JobExecucao_Bat_Vendas_1", "JobControl")
End Else
Call DSSetUserStatus(0)
End


Open "HSH_ARQUIVO" to H.PARAMETROS Then
Read PARAM from H.PARAMETROS, 1 then
Ans = PARAM<1>
End
End
Close H.PARAMETROS


* Setup JobExecucao_Bat_Vendas_2, run it, wait for it to finish, and test for success
hJob2 = DSAttachJob("JobExecucao_Bat_Vendas_2", DSJ.ERRFATAL)
ErrCode = DSSetParam(hJob2, "pFileName", Ans)
If NOT(hJob2) Then
Call DSLogFatal("Job Failed: JobExecucao_Bat_Vendas_2", "JobControl")
Abort
End
ErrCode = DSRunJob(hJob2, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob2)
Status = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSSetUserStatus(1)
Call DSLogFatal("Job Failed: JobExecucao_Bat_Vendas_2", "JobControl")
End Else
Call DSSetUserStatus(0)
End

Posted: Fri May 19, 2006 3:57 pm
by ds_developer
Look in the Director log of "JobExecucao_Bat_Vendas_2". The first log entry will list the parameters for the job - see if the "pFileName" parameter is set as you expect.

You can add calls to DSLogInfo to your Job Control to write debugging statements to the log file. The format is just like the DSLogFatal calls you are currently using.

John

Posted: Fri May 19, 2006 5:41 pm
by kduke
I think John is correct. Is your hash file key = 1? How did you get your parameter value in the hash file?