I'm trying to write a CL or RPG program to track users logged onto the system. Is there a way to do this?
There are no files that keep track of when people log onto the system. There is an API that you can use to retrieve the current jobs on the system. It also includes the type of job, so extracting the interactive jobs would tell you everyone who is logged on to the system. The API is QUSLJOB. The API lists jobs into user space using parameters passed to the API.
I don't have a complete example, but I do have portions of code I am including. You will need to create a user space, and then call the API to list the jobs by type into the user space. You will then need to get the pointer to user space and read through the user space using pointers to retrieve the interactive jobs.
Click here to view the code to perform.
Dig Deeper on iSeries CL programming
Related Q&A from John Brandt
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.