Looping a Job on Windows
Moderators: chulett, rschirm, roy
Looping a Job on Windows
Hi All,
I have a DataStage job which needs to be executed 12 times with different set of parameters passed for each run.
I s there any way to loop this job for 12 times? If Yes, How can I do this?
I couldn't find any Start End Loop Activity in DS 6.0.
Thanks in Advance.
I have a DataStage job which needs to be executed 12 times with different set of parameters passed for each run.
I s there any way to loop this job for 12 times? If Yes, How can I do this?
I couldn't find any Start End Loop Activity in DS 6.0.
Thanks in Advance.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can most easily accomplish this with a job control routine. Where do the twelve sets of parameter values come from? The following example assumes one set of parameter values per line in an input file.
Code: Select all
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
$INCLUDE UNIVERSE.INCLUDE FILEINFO.H
DEFFUN OpenSequentialFile(FilePath,OpenMode,WriteMode,LogMode) Calling "DSU.OpenSequentialFile"
hFile = OpenSequentialFile(pathname, "R", "A", "Y")
If Fileinfo(hFile, FINFO$IS.FILEVAR)
Then
For LineNo = 1 To 12
ReadSeq Line From hFile Else Exit
GoSub ParseParameters
hJob = DSAttachJob("MyJob", DSJ.ERRNONE)
ErrCode = DSSetParam(hJob, "Param1", Param1Value)
ErrCode = DSSetParam(hJob, "Param2", Param2Value)
ErrCode = DSRunJob(hJob, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob)
JobStatus = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
Msg = "Iteration " : LineNo : " complete. Job status = " : JobStatus
If JobStatus = DSJS.RUNFAILED Or JobStatus = DSJS.CRASHED
Then Call DSLogWarn(Msg, "JobControl")
Else Call DSLogInfo(Msg, "JobControl")
ErrCode = DSDetachJob
Next LineNo
CloseSeq hFile
End
Else
Msg = "Can not open parameters file " : Quote(pathname) : " for reading."
Call DSLogFatal(Msg, "Job control")
End
MainExit:
RETURN
ParseParameters:
* Here you parse out the parameter values from the line read from file.
Param1Value = Field(Line, ";", 1, 1)
Param2Value = Field(Line, ";", 2, 1)
RETURN
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Any Microsoft education center would probably be able to help you. There are lots of books out there, such as DOS For Dummies - it's not a DataStage problem that you want to learn batch programming.
You might also acquire a UNIX emulator, such as MKS Toolkit or CygWin, that would mean that you can run your UNIX scripts on a Windows operating system.
You might also acquire a UNIX emulator, such as MKS Toolkit or CygWin, that would mean that you can run your UNIX scripts on a Windows operating system.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: