Link to home
Start Free TrialLog in
Avatar of SaravananM
SaravananM

asked on

Who are the active users to AS/400

Hi All,
We are trying to get the active users logged into AS/400. We know that it is possible using wrkactjob. But, we want a simpler method to get the same.
Thanks in advance!
Saravanan M
Avatar of Member_2_276102
Member_2_276102

Saravanan:

Can you clarify what you mean by "logged on"?

Anybody connected via ODBC is "logged on" -- would that count? If passwords are required for DDM, then DDM users are "logged on". An FTP session will "log on".

Tom
You can dump the basic statistics for all user profiles to the printer or an outfile using DSPUSRPRF.
Example:
dspusrprf usrprf(*all) type(*basic) output(*outfile) outfile(qtemp/usrprf)
runqry *none qtemp/usrprf

The field is call "Previous Sign-on Date"
Avatar of SaravananM

ASKER

Hello tliotta,

I want to know who are the users currently signed on to AS/400. I want to know their user profile name and the Message Queue.

My requirement is this. I have to send "Hello" message to all of them who are currently signed on to AS/400.  I hope that you got it now.

Hello JHammerer: The DSPUSRPRF command retrieves all the user profiles. But I want the active user list - Currentl Signed on user List.

Regards,
Saravanan M
ASKER CERTIFIED SOLUTION
Avatar of ShadowProgrammer
ShadowProgrammer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another thought...

do you want to
     send an "hello" message to all users signed on at the time you choose to send the message
or
     send an "hello" message to a user when they sign on ?

If the latter, do you want to send an "hello" message each time they sign on or just the first time they sign on each day ?

Also if  the latter, you could create a CL program which you could then assign as the initial program for all users (or maybe selected groups of users)... CHGUSRPRF INLPGM(NameOfCLpgm)
If your users already have an initial program, you could add a call to this new CL program in the existing program.

In this new CL program...
  retrieve user profile from current job RTVJOBA USER(&USER)   where &USER is CHAR(10)
  send the "hello" message to the user.

If you want to only do this the first time they sign on each day, in the CL....
  retrieve either the job date on the RTVJOBA command or system date RTVSYSVAL QDATE (&QDATE)
  retrieve the last signed on date for the user profile  RTVUSRPRF USRPRF(*CURRENT) PRVSIGN(&PRVSIGN)
  compare the date last signed on and the job/system date and if different send the "hello" message.

NB. Use AS400 help for required definition of the fields being used to hold the values retrieved.
If you compare against the sytem date, you can retrieve the user profile when getting the date last signed on
        RTVUSRPRF USRPRF(*CURRENT) RTNUSRPRF(&RTNUSRPRF) PRVSIGN(&PRVSIGN)
If you retrieve the job attributes, you could send a break message to the WRKSTN message queue...
SNDBRKMSG TOMSGQ(&JOBNAME)   [ job name = workstation id on interactive jobs ]

Tony.
Hello all,

Thanks a lot for your response.

Regards,
Saravanan M
One more question.

How do I get the Active users list? If I use the *ALLACT, it will send the message to all the users. But I will not be getting the list in my program. Right?

If I want to do some processing against those user id's, lets say Save the user Ids in a database file, how do I get the list of user Ids?

Can you help me out in this?

Thanks in advance.

Saravanan M
Thanks for the marks/grade...

You are right, you would not be getting a list of users back into your program.

There should be an API (maybe Open List of Jobs - QGYOLJOB) which will retrieve jobs on the system, you are only looking for the active interactive jobs.

An alternative (old fashioned) method if you aren't into APIs, you could direct the output of a WRKACTJOB to print, copy the resulting spool file into a flat file and then process the flat file in an RPG program to retrieve the user ids of the interactive jobs.

Tony.
Saravanan:

If you want interactive jobs only, then use QUSLJOB (List jobs) API and specify 'I' for the Job Type optional parameter. This causes the API to list only interactive jobs into the space.

Or use the QEZLSGNU (List Signed-On Users) API from Operational Assistant. This also lists to a user space and might seem a little closer to your original question.

As with all such APIs, you would want error checking to make sure that the job in the list is still active by the time your program processed that entry from the list.

Sending messages to '*ALLACT' can be a good choice if you want to send messages to every user. Be aware that the message may not be seen. The receiving user might have the user message queue set to *NOTIFY or *HOLD.

You can also use SNDBRKMSG TOMSGQ(*ALLWS), but has other irritations.

Perhaps the best choice for messages of this type is to use the QEZSNDMG (Send Message) API, also from Operational Assistant. This is the API behind option <4=Send messages> when you use the GO ASSIST menu. You'd use '*ALLACT' for the 'List of user profile or display station names' parameter.

Tom
Thank you very much for your help.

Regards,
Saravanan M