Slide 9 of 80
Notes:
The JOBCNT function returns the number of job/sessions that match the “job_spec”, regardless of the state of the matching job/sessions. In other words, JOBCNT does not filter based on whether the job is waiting, scheduled, executing, etc. The function return is valid only for the moment it is returned, as a system’s job/session count can continually fluctuate.
The “job_spec” parameter allows just jobs or just session to be selected for a given “user.acct” specification. For example, to find only the jobs logged on as MANAGER.SYS use: JOBCNT (“ @J:MANAGER.SYS”)
It is possible to retrieve the job/session IDs for the matching jobs by passing the “joblist_var” parameter. This unquoted argument names an existing or new CI string variable. It will be set to a list of matching job/session IDs of the form: J|Snnn, followed by a space, followed by the next ID, etc. For example: “S123 S445 J9 S567 J10”Since CI string variables currently cannot exceed 1024 characters, it is possible that the “joblist_var” passed to JOBCNT cannot contain all of the matching job IDs. This situation is only detected by comparing the number of tokens in the “joblist_var” against the function return. For example: setvar cnt JOBCNT(“@”,jlist) if cnt <> wordcnt( jlist) then ... # not all matching jobs in variable
Assuming three digit job numbers, approximately 204 matches will fit in the “joblist_var” variable. Possible solutions to this restriction are:
- use separate JOBCNT calls for jobs and sessions
- use separate JOBCNT calls for various target accounts
There are no restrictions on the use of JOBCNT. Any user, regardless of their capabilities, can specify any “job_spec” and retrieve the matching job/session IDs.