Page 1 of 2
Job Control Error
Posted: Thu Nov 19, 2009 3:37 am
by gssr
I used the Job Control to call all the BATCh job in a sequence
While compiling the main job ,It throws me Errors based on parameter,
'$' unexpected, Was expecting: ')', ','
0271 ErrCode = DSSetParam(hJob5, "$OracleUser", $OracleUser)
Can anyone have an Idea regarding this?
Thanks in Advance..
Posted: Thu Nov 19, 2009 6:02 am
by ArndW
DataStage Server (which includes Job Sequences) does not allow the "$" sign as part of a variable name, which is why you are seeing the error.
Posted: Thu Nov 19, 2009 6:29 am
by chulett
Why are you trying to 'set' a job parameter that's actually an environment variable? There's no need to do that as it will automatically pick it up from the... well... environment.
Posted: Thu Nov 19, 2009 7:23 am
by ray.wurlod
Retrieve its value using DSGetParamInfo() function.
Posted: Fri Nov 20, 2009 12:49 am
by gssr
ArndW wrote:DataStage Server (which includes Job Sequences) does not allow the "$" sign as part of a variable name, which is why you are seeing the error. ...
Actually I am using the code in the DS Parallel Job Control to call all other Jobs
Posted: Fri Nov 20, 2009 12:54 am
by gssr
chulett wrote:Why are you trying to 'set' a job parameter that's actually an environment variable? There's no need to do that as it will automatically pick it up from the... well... environment. ...
I am using the following Code to call the batch jobs assciated with the main job,
Code: Select all
JobName1= "LOAD_TEST_TABLE"
Call DSLogInfo("Validating ":JobName1:".done", ThisJobName)
* Call DSU.UtilityHashLookupGR( RunTime,HashFile, JobName1,1)
* Call DSLogInfo(JobName1:" Run Time:":RunTime, ThisJobName)
Call DSExecute("UNIX", $pShellScript:"isfilethere.ksh ":$DoneFileDir:" ":JobName1:".done" , Output, SystemReturnCode)
If (SystemReturnCode <> 0) Then
Call DSLogInfo("File ":JobName1:".done is not present", ThisJobName)
Call DSLogInfo("Resetting Jobs", ThisJobName)
hJob1 = DSAttachJob(JobName1, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: ":JobName1, "JobControl")
Abort
End
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
ErrCode = DSRunJob(hJob1, DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: ":JobName1, "JobControl")
End
End
* Setup JobName1, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob(JobName1, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: ":JobName1, "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "$DSDir", $DSDir)
ErrCode = DSSetParam(hJob1, "$OracleUser", $OracleUser)
ErrCode = DSSetParam(hJob1, "$OracleRemote", $OracleRemote)
ErrCode = DSSetParam(hJob1, "$OraclePwd", $OraclePwd)
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then
* Fatal Error - No Return
* Reply = grSendMail(JobName1,abort)
Call DSLogFatal("Job Failed: ":JobName1, "JobControl")
End
Call DSExecute("UNIX", "touch ":$DoneFileDir:JobName1:".done" , Output, SystemReturnCode)
If (SystemReturnCode <> 0) Then
Call DSLogFatal("FAILED- Touch ":JobName1:".done",ThisJobName)
End
End
Else
Call DSLogInfo(JobName1:" ALREADY FINISHED...", ThisJobName)
End
Posted: Fri Nov 20, 2009 5:23 am
by ArndW
I should amend my first note to say that variables starting with $ aren't allowed in BASIC. But looking at my generated code it seems that you can use "($OracleUser)"
Posted: Fri Nov 20, 2009 5:31 am
by gssr
Not including the Parameters in the Main job that calls all other Batch jobs ,is the ERROR that creates this problem.
Problem Solved!
Thank u for everyone!!
![Cool 8)](./images/smilies/icon_cool.gif)
Posted: Fri Nov 20, 2009 7:38 am
by chulett
Still... all this...
completely unnecessary:
Code: Select all
ErrCode = DSSetParam(hJob1, "$DSDir", $DSDir)
ErrCode = DSSetParam(hJob1, "$OracleUser", $OracleUser)
ErrCode = DSSetParam(hJob1, "$OracleRemote", $OracleRemote)
ErrCode = DSSetParam(hJob1, "$OraclePwd", $OraclePwd)
Posted: Mon Nov 23, 2009 2:39 am
by gssr
chulett wrote:Still... all this...
completely unnecessary:
Code: Select all
ErrCode = DSSetParam(hJob1, "$DSDir", $DSDir)
ErrCode = DSSetParam(hJob1, "$OracleUser", $Ora ...[/quote]
Then how can we mention the Parameters and the defaults? Is there any other options for referring the Parameters in Job C ontrol. The above mentioned CODE is a templete that we used in our whole project.
:roll: :?:
Posted: Mon Nov 23, 2009 3:58 am
by ray.wurlod
If you don't set them at all, they take their default values. (That's what "default" means in this context.)
Where is your routine obtaining the values with which to set the parameters?
Posted: Mon Nov 23, 2009 4:59 am
by gssr
The Parameters are called as User Defined Environment Variable!
Posted: Mon Nov 23, 2009 7:23 am
by chulett
I wouldn't be quibbling if you were overriding their value. As noted, there's no reason to set any variable to its default value, especially an environment variable that will automatically get its value from the environment without any help from you. That's what they do.
Posted: Tue Nov 24, 2009 4:12 am
by gssr
Posted: Tue Nov 24, 2009 6:46 am
by chulett
Why, that's elemental my dear Watson, when you need to
override it, set it to a
non-default value. As already noted. Thrice now, I believe. And that's not called a
default value for no reason.
![Wink :wink:](./images/smilies/icon_wink.gif)