Job Control Error

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Job Control Error

Post 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..
RAJ
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Retrieve its value using DSGetParamInfo() 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.
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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
RAJ
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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


RAJ
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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)"
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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!! :!: 8)
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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) 
-craig

"You can never have too many knives" -- Logan Nine Fingers
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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:  :?:
RAJ
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

The Parameters are called as User Defined Environment Variable!
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

chulett wrote: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.
As you mean, there is no need to mention the parameter in this Code?? Then in what situation DSsetparam is used?

:!: :!: :!: :!:
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

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