routine compile error

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
sumeet
Premium Member
Premium Member
Posts: 54
Joined: Tue Aug 30, 2005 11:44 pm

routine compile error

Post by sumeet »

Hi,

I have routine where I open a seq file..read the content and pass it as a parameter to the job. So basically this is the Before Job Sub Routine.

I have couple of questions :

1> it gives an error during compilation--
0046
^
End of File unexpected, Was expecting: Array Name, Variable name,
New variable name, ';', Statement label, "ABORT", "ABORTE", "ABORTM",
"BEGIN", "BREAK", "CALL", "CHAIN", "CLEAR", "CLEARCOM", "CLEARDATA,..........
1 Errors detected, No Object Code Produced.


2> is the code correct for what I am doing.

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

valid.open = @FALSE

      ParamFile = '/clocal/ivp/dvlp/tmp/Param.txt'

      OPENSEQ ParamFile TO PARAM.FILE Then

         valid.open = @TRUE

      End

      If NOT(valid.open) Then

         Call DSLogFATAL("Could not open the parameter file: ":ParamFile,"Msg")

      End

         READSEQ Params FROM PARAM.FILE

         On Error

            Call DSLogFATAL("Could not read the parameter file: ":ParamFile,"Msg")

                     
            ParamValue = Field(Params, 1,1)


      ParamName = 'PHID'

      CLOSESEQ PARAM.FILE

      JobHandle = DSJ.ME
      JobName = DSGetJobInfo(JobHandle,DSJ.JOBNAME)

      ErrCode = DSSetParam (JobHandle,ParamName,ParamValue)

      Call DSLogInfo('SetParam ErrCode = ': ErrCode, 'Msg')



RETURN
I have tried Return..END...nothing seems to work.

Thanks
Sumeet
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Click on the Format button. The indenting will show clearly where you went wrong.

As noted in another thread, what you are trying to do will not work in a before-job subroutine using DSJ.ME as the job handle.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sumeet
Premium Member
Premium Member
Posts: 54
Joined: Tue Aug 30, 2005 11:44 pm

Post by sumeet »

Ray,

Then how do I accomplish this :

I have a sequencer. It loads a Seq file. I use the data in the file as Parameter in next Job in sequencer.

I thought before Job Sub routine should be good :( .

Thanks
Sumeet
sumeet
Premium Member
Premium Member
Posts: 54
Joined: Tue Aug 30, 2005 11:44 pm

Post by sumeet »

Ray,

I went through the forum this ..solution posted by Kenneth.

I tried out that. But

Code: Select all

Cmd = "cat /clocal/ivp/dvlp/tmp/Param.txt":"|cut -c2-5"
	 
        Call DSExecute("UNIX", Cmd, Output, SystemReturnCode)

        Ans = Output
      
        
* Setup Test7Job, run it, wait for it to finish, and test for success
         hJob1 = DSAttachJob("Test7Job", DSJ.ERRFATAL)
         If NOT(hJob1) Then
            Call DSLogFatal("Job Attach Failed: Test7Job", "JobControl")
            Abort
         End
         ErrCode = DSSetParam(hJob1, "$ivpDirParm", "$ENV")
         ErrCode = DSSetParam(hJob1, "$ivpDB2User", "$ENV")
         ErrCode = DSSetParam(hJob1, "$ivpDB2Passwd", "$ENV")
         ErrCode = DSSetParam(hJob1, "$ivpDB2DBStg", "$ENV")
         ErrCode = DSSetParam(hJob1, "$ivpDirTmp", "$ENV")
         ErrCode = DSSetParam(hJob1, "PHID",Output)
         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: Test7Job", "JobControl")
         End
gives PHID=' ' .
I dont understand why the Output of Unix command is not getting supplied to the DSSetParam(hJob1, "PHID",Output).

Thanks
Sumeet
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's no End to the On Error clause of your ReadSeq statement. Therefore your routine is syntactically incorrect and will not compile.

Your later question is unrelated to the compile error and therefore deserves a separate thread. You are not allowed to hijack even your own threads here. :x
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Add a CALL DSLogInfo line to output the results of your command to the job log so that you can see the value returned. You'll probably see your problem.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply