Page 1 of 1

How to fetch USER ID in rexx ?

PostPosted: Thu Feb 25, 2010 1:57 pm
by Balamurugan3
Hi .... I need to fetch USER ID in which the user has logged in ... by using rexx.... Can any help me in finding it out... I have an requirement where i need to allocate a dataset... depending upon different environment user logs in... Diff env has diff user ID.... So Can anyone suggest a solution....

many thanks..... Bala....

Re: How to fetch USER ID in rexx ?

PostPosted: Thu Feb 25, 2010 3:30 pm
by expat
Click HERE to read the correct manual.

Re: How to fetch USER ID in rexx ?

PostPosted: Thu Feb 25, 2010 5:19 pm
by Robert Sample
The user id, unless there is something site specific being used, does not tell you what the environment is. Google is your friend -- you can find REXX code to do this on the Internet.

Re: How to fetch USER ID in rexx ?

PostPosted: Thu Mar 11, 2010 10:28 am
by Pedro
Rather than userid, use the user's prefix. It might not be the same as the userid.

Re: How to fetch USER ID in rexx ?

PostPosted: Tue Apr 06, 2010 8:58 pm
by Bala1
Hi Bala,

I am not sure if the following sample could help you. I would suggest you to just pull the userid and depending on the environment and the user id the RACF would allow the creation of files. You can hard code the initial qualifiersbased on the same and then pass to the subsequent rexx code or JCL....


**************************************************************
/*REXX*/
str=userid()
select
when substr(str,1,2)="PRD" then
do
HQL1=PROD
HQL2=PRD
end
when substr(str,1,2)="TST" then
do
HQL1=TEST
HQL2=TST
end
when substr(str,1,2)="DEV" then
do
HQL1=DEVE
HQL2=DEV
end
end

******************************************************************
In the example dependign on the nature of the ids (production,test, dev) the first 2 qualifiers are hard coded.


cheers,
Bala

Re: How to fetch USER ID in rexx ?

PostPosted: Wed Apr 07, 2010 11:52 am
by expat
Bala1

I would bet a penny to a pound that you did not test that code before posting it, because there is no way on earth that a substr(var,1,2) would EVER match a three character string.

Re: How to fetch USER ID in rexx ?

PostPosted: Fri Apr 09, 2010 4:19 pm
by Bala1
Hi expat,
I am really sorry it should have been substr(var,1,3) to validate 3 strings. It was a typo... I should have tested the code. Going forward would make sure that i have executed once and then post the solution.

My apologies for any confusion caused. but the logic can be used i believe.

Cheers,
Bala