Problems for Job Control

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rochaul
Participant
Posts: 8
Joined: Fri May 19, 2006 12:10 pm

Problems for Job Control

Post 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
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post 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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I think John is correct. Is your hash file key = 1? How did you get your parameter value in the hash file?
Mamu Kim
Post Reply