Get User State

GetUserState

The GetUserState procedure returns the current number of active jobs for a given user profile.

The GetUserState procedure can be used to number of sign-on sessions (jobs) for the specific user. The return value represents both batch and interactive jobs that are currently active for the specified user.

sign-on-count GetUserState(
  szUserProfile   10A    Const 
  szOption        10A    Const Options(*NOPASS) 
)

See also: CrtUsrList

Parameters

szUserProfile
[input Char(10) const]  The user profile name who's current sign-on count is returned.
 
szOption [ optional | Reserved ]
[input Char(10) ]  This parameter need not be specified and is reserved for future use. 

Return Value

If the function succeeds, the number of current signed-on sessions (jobs) active for the user is returned.

Remarks

Both batch and interactive jobs are counted. The purpose of this procedure is to check if a user profile is currently signed on. Currently there is no way to determine that only interactive jobs are checked.

Example

 

The following example retrieves the count of the number of active jobs for the QPGMR user profile.

 
      /INCLUDE QCPYSRC,utils
 
.....DName+++++++++++EUDSFrom+++To+++++TDc.Functions+++++++++
     D nSignOnCount    S             20I 0 
 
     C                   Eval      nSignOnCount = GetUserState('QPGMR')