Thanks to all, you confirmed what I suspected.
Since we are not swapping to other user profiles the PGMSDS solution should
work.
The program where I used it runs already for a while, without any problems.
My colleague only read my comment and did not know there are 2 "User" fields
within the PGMSDS.
Sometimes it seems better not to comment your code ;)
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Mark S. Waterbury
Gesendet: Wednesday, 15. December 2010 15:05
An: RPG programming on the IBM i / System i
Betreff: Re: Current User Job Attribute and Current User in Program Status
Data Structure
Hi, Birgitta:
The value in the PSDS is initialized once by the generated code, just
prior to calling any *INZSR subroutine, if one is present.
The problem is, the application could swap to another profile, e.g. by
calling QSYGETPH and QWTSETP, and the value in the PSDS would no longer
name the correct profile.
In a CL program or module, you can issue:
RTVUSRPRF USRPRF(*CURRENT) RTNUSRPRF(&CURUSER)
In RPGLE, you could call the QUSRJOBI API with format JOBI0600 to
retrieve the current user dynamically.
So long as you _know_ that the application does not swap profiles, the
PSDS value should be fine.
Does that help?
All the best,
Mark S. Waterbury
On 12/15/2010 8:33 AM, Birgitta Hauser wrote:
Hi,
Can someone enlighten me! We have some discussions.
I used the current user out of the program status data structure (position
358) instead of calling a CL Program that does nothing else than RTVJOBA
CURUSER(&X).
My colleague insists I have to call this CL program because it is not the
same.
Can someone enlighten me? Is the current user (job attribute) the same as
the current user within the PGMSDS or not?
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
As an Amazon Associate we earn from qualifying purchases.