Reading from Parameter File

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
pramod_au
Participant
Posts: 30
Joined: Thu Feb 06, 2003 8:30 am
Location: London,UK

Reading from Parameter File

Post by pramod_au »

Hello

I have a parameter file which contains userId,Password,
Base directory path. I dont want to hardcode some parameters and path in my JOB.
I have have sequencer designed for my job. Can i read the parameter file and pass those parameter to the job sequencer,which in turn pass these parameters to Individual jobs present in the sequencer?

AIM :TO READ PARAMETER FILE AND USE IN JOB SEQUENCERS





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

Post by ray.wurlod »

Yes you can. Again, a small amount of DataStage BASIC code will be required. An example will appear in the soon-to-be-announced CD of tools from the folks who bring you this site.


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
peterh
Participant
Posts: 9
Joined: Thu Feb 13, 2003 2:34 am

Post by peterh »

Here is piece of code which should help you...

Peter

* Get Parameters from file

ParFile=DSGetParamInfo(DSJ.ME,"ParamFile",DSJ.PARAMVALUE)
eof=0
LineNum=1
openseq ParFile to fileID else abort
loop until eof
readseq IDLine from fileID else eof = 1
IF LineNum=1 THEN
TDir=TRIM(FIELD(IDLine,";",1))
TDB=TRIM(FIELD(IDLine,";",2))
TUsr=TRIM(FIELD(IDLine,";",3))
TPwd=TRIM(FIELD(IDLine,";",4))
END
LineNum=LineNum+1
repeat

closeseq fileID
.
.
.
.
hJob1 = DSAttachJob(Job, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed : ":Job, "JobControl")
Abort
End
* Fill Parameters
ErrCode = DSSetParam(hJob1,"SrcFilePath",DatFile)
ErrCode = DSSetParam(hJob1,"TDir",TDir)
ErrCode = DSSetParam(hJob1,"TDB",TDB)
ErrCode = DSSetParam(hJob1,"TUsr",TUsr)
ErrCode = DSSetParam(hJob1,"TPwd",TPwd)

ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
Post Reply