Problem with Routine

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
suma
Participant
Posts: 32
Joined: Fri Jun 11, 2004 8:18 am

Problem with Routine

Post by suma »

Thanks a LOT!! Its very useful.I have generated code thro Job Control tab in Job Parameter.

But if i compile it in a Routine i am facing the same problem
Here is the code i generated,

hJob1 = DSAttachJob("test1", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: test1", "JobControl")
Abort
End
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: test1", "JobControl")
End

The error i get is

Array 'DSAttachJob' never dimensioned.
WARNING: Variable 'DSJ.ERRFATAL' never assigned a value.
Array 'DSRunJob' never dimensioned.
WARNING: Variable 'DSJ.RUNNORMAL' never assigned a value.
Array 'DSWaitForJob' never dimensioned.
Array 'DSGetJobInfo' never dimensioned.
WARNING: Variable 'DSJ.JOBSTATUS' never assigned a value.
WARNING: Variable 'DSJS.RUNFAILED' never assigned a value.
WARNING: Variable 'DSJS.CRASHED' never assigned a value.
WARNING: Variable 'Ans' never assigned a value.

4 Errors detected, No Object Code Produced.


Can you tell me why i get this error 'never dimensioned' I get this error very often
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Because DataStage has no clue that the functions you are trying to call are job control functions. Without you helping out, it thinks they are variables that you have never declared, i.e. never 'dimensioned'.

Add this to the top of the routine:

Code: Select all

$IFNDEF JOBCONTROL.H 
$INCLUDE DSINCLUDE JOBCONTROL.H 
$ENDIF 
This will cause the header file that contains the definitions of the Job Control functions you are using to be included in the routine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply