DS Function to retrieve Project Level Environment Variable?

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
reddyla
Charter Member
Charter Member
Posts: 7
Joined: Fri Sep 02, 2005 9:31 am

DS Function to retrieve Project Level Environment Variable?

Post by reddyla »

Hi, I'm trying to retrieve a project environment variable from within a routine. I would like to avoid passing the value in as an argument to the routine so was hoping there would be a DS Function I could use. There is a function DSGetParamInfo, but that retrieves job level params, I'd like project level. Thanks!
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Did you try searching?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
reddyla
Charter Member
Charter Member
Posts: 7
Joined: Fri Sep 02, 2005 9:31 am

Post by reddyla »

DSguru2B wrote:Did you try searching?
I did. I could only find what sounded like a workaround - a Call DSExecute to do an echo in unix. It never mentions whether there is or isn't a function for project info. I thought there would be, but if not, that's fine, will get the info I need from the unix env.
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

HI

Yes we can get the job level parameter information from the unix environtment. The command to be used is

dsjob -lparam <project name > <job name>


for further help do go though the server.pdf document under the heading
Command Line Interface near about 700 page....
Regards,
Shree
785-816-0728
reddyla
Charter Member
Charter Member
Posts: 7
Joined: Fri Sep 02, 2005 9:31 am

Post by reddyla »

Sreedhar wrote:HI

Yes we can get the job level parameter information from the unix environtment. The command to be used is

dsjob -lparam <project name > <job name>


for further help do go though the server.pdf document under the heading
Command Line Interface near about 700 page....
Hi Sreedhar,

Thanks, that is good to know.

But what I was trying to do was get a project environment variable from within a routine. I was hoping a function existed.

If it does not, I will use Call DSExecute("UNIX", "echo $SrcFileDir",ReturnVal,ReturnCd)

I learned from the other post I found that project env variables become unix env variables at runtime. But, one last time, I was just wondering if there was a DS function that you pass an project env var name to, and it returns the value.

If not, that's fine, I'll close this. Thanks
Last edited by reddyla on Thu Mar 15, 2007 3:33 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You want to 'get' as in use the variable in your routine? What happens when you just reference it? Pretty sure the reference would need hash / pounds signs around it, so:

Code: Select all

#$SrcDir#
For example. Or did you try that and it didn't work for you?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

There is a function present in px jobs, not in ds jobs. The work around is to get it from the unix level by echoing it.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
reddyla
Charter Member
Charter Member
Posts: 7
Joined: Fri Sep 02, 2005 9:31 am

Post by reddyla »

chulett wrote:You want to 'get' as in use the variable in your routine? What happens when you just reference it? Pretty sure the reference would need hash / pounds signs around it, so:

Code: Select all

#$SrcDir#
For example. Or did you try that and it didn't work for you?
Hi Craig, yes I tried that, it didn't work. It produces an error when I try to compile the routine.

Not Brian, that's what I was wondering. Thanks very much everyone.
Last edited by reddyla on Thu Mar 15, 2007 3:41 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yah, sorry - Parameters of that nature are not visible to routines. However, I would think you should be able to pass it in as an argument to your routine and then reference it as I suggested in the call itself. Worth a shot.

Can you tell I've never had much need for environment variables? :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Neither do I, dsxchange sort of makes you an expert in all fields, does'nt it :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hey - what happened? Suddenly we're Resolved - can you please share with us the resolution? :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

reddyla wrote:Not Brian, that's what I was wondering.
Excellent! I think I'll start calling him "Not Brian" too. :lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Yea, funny guys, ha ha ha.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is a "UniVerse" command called ENVIRONMENT (or just ENV) which returns a list of all current (set) environment variables. You could invoke this through DSExecute.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply