How to use Environment Variable in Routine?

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

How to use Environment Variable in Routine?

Post by MrBlack »

How to use Environment Variable in Routine?

This is what I'd hope to be able to do:

Code: Select all

Ans = $myenvvar
I've found other posts describing calling the unix command and junk but I can't get anything I've found to work.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is a function for this - something like GetEnvironment() or GetEnvVar() - but I'm recovering from NYE drinkies and can't recall exact details. It'll be in online help and the manuals somewhere.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Why would you want to return the env var?

I'm asking because it will ,usually, be available from where you invoked the routine as well.

so I would send the values as arguments to the routine and then you can stay with the ordinary implementation of the routine.

can you explain more regarding what is it your trying to do?
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

Post by MrBlack »

Roy

I won't actually be returning the variable. What I'm doing is building a routine that is going to be executing a specific SQL query with a specific user/password. So I'm hard coding everything into a routine so when this is used in the jobs, the routine call is going to be very simple and I only have to provide the necessary elements.

Call from a job:

Code: Select all

Get_List(#listname#)
Then the routine would look like this:

Code: Select all

user = $env_user
pass = $env_pass
query = "very specific query where list_name =" : Arg1

execute query

Ans = query.results
The user and password that needs to execute this query will never change and I don't want the other developers on the project to have to remember or know which database user should be used. I just want them to only have to pass in the list name and get a result back.
Post Reply