Access to environment variable inside routine

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
MAT
Participant
Posts: 65
Joined: Wed Mar 05, 2003 8:44 am
Location: Montréal, Canada

Access to environment variable inside routine

Post by MAT »

Hi all,

Does anybody know if there is a way to access a DS environment variable inside a Basic routine?

Thanks

Mat
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Is it for a routine or function? If it's a routine for before/after execution, just do a system call (DSExecute) to check the environment and parse the results.

If it's for a BASIC function to be used for transformation, you're not going to want to do system calls inside your processing loop. You'll want to do a call once at job startup and share across transformers. The easiest way is to do this in job control before hand and pass it in as a job parameter.

If you absolutely need it in a BASIC function and not a job parameter, you'll want to search the forum for discussion on labeled COMMON statements in functions. This will allow you to do a one-time system call, initialize a variable, then reuse that variable for the rest of the job's runtime. But, you'll have to use a user-defined function to access that COMMON variable.
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
MAT
Participant
Posts: 65
Joined: Wed Mar 05, 2003 8:44 am
Location: Montréal, Canada

Post by MAT »

Thanks for your reply.

It is for a routine I use to execute my job sequencers. The routine sets parameters from a file, excute the job sequencer, gather stats and logs. The thing is that I want my DS modules to be portable on other servers and projects. Hence, I need a variable that tells my routine where to look for it's root folder containing the runtime variables file and data files. The variable name is teh same in every project but it's value is specific to the project. If I set an evironment variable inside the job sequencer that calls my routine, it will not update itself when I export and import my jobs to others projects. It will keep the default value it had when first defined. This is why I would like to be able to access it at runtime so I get the real value either inside my routine or inside my job sequencer.

thanks

Mat
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

I'm not sure if I answered your question or at least pointed you in the right direction.
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
Mat05
Participant
Posts: 4
Joined: Wed Oct 22, 2003 1:56 pm
Location: Montreal, Canada

Post by Mat05 »

Yes, you answered it. I used DSExecute and got my variable.

Thanks a lot

Mat
Post Reply