DataStage: How to assign value into Job Parameter?

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
Klaus Schaefer
Participant
Posts: 94
Joined: Wed May 08, 2002 8:44 am
Location: Germany
Contact:

Post by Klaus Schaefer »

Iawan,

this is a rather "standard" technique with DataStage job control. Please find below a very simple sample that may show you the technique on how to retrieve parameters from a file and pass them over to a job that is to be started. For further information please have a look into the "DataStage Server Job Developers Guide" and the "DataStage BASIC guide":

eof=0
clientid = ''

openseq "c:datadsdatamercolineclientid.txt" to fileID else abort

loop until eof
readseq IDLine from fileID else eof = 1
if trim(field(IDLine,'=',1)) = @Logname then
clientid = trim(field(IDLine,'=',2))
call DSLogInfo("Client-Id = ":clientid,"JobControl")
goto weiter
End
repeat

clientid = 1000
call DSLogWarn("Kein Eintrag fuer Client-Id gefunden, default 1000 verwendet.","JobControl")


weiter:
closeseq fileID



* Setup FilterDuplicates, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("FilterDuplicates", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: FilterDuplicates", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "dsn", dsn)
ErrCode = DSSetParam(hJob1, "clientid", clientid)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: FilterDuplicates", "JobControl")
End



Best regards
Klaus
Post Reply