Job and Session Status Information [ Getting System Information Programmer's Guide ] MPE/iX 5.0 Documentation
Getting System Information Programmer's Guide
Job and Session Status Information
The commands and intrinsics described in this section allow you to obtain
information about jobs or sessions currently running on the system. You
can see a description of one job or session, or more than one; if you
have the necessary capability, you can access information about jobs or
sessions other than the one that you are in.
It is also possible to use variables in the JCL or in a command file to
obtain job and session status information. How to do this is
demonstrated in the following section.
Obtaining current status with SHOWME
This command, entered without parameters, reports the status of the job
or session you are in. It may be issued from Break or from a program.
When you enter SHOWME, you see a display similar to the following:
USER: #S296,MGR.PRXL.INFO (IN PROGRAM)
RELEASE: B.40.00 MPE/iX 31900 USER VERSION: B.40.00
CURRENT: WED, AUG 1, 1992, 1:46 PM
LOGON: WED, AUG 1, 1992, 8:39 AM
CPU SECS: 3 CONNECT MINUTES: 309
$STDIN LDEV: 39 $STDLIST LDEV: 39
****************************************************
** WELCOME TO THE PIRANHA SYSTEM **
****************************************************
The fields in this example have the following meanings:
USER: Job or session number, and fully qualified user ID.
(IN... Message indicating where SHOWME was executed: IN
PROGRAM, IN BREAK, or NOT IN BREAK (that is,
directly from MPE).
RELEASE The user-defined version of the software that you
are running.
(BASE... The base MPE version that you are running. This is
the official Hewlett-Packard version number for the
operating system software, and you cannot modify
it.
CURRENT Current system time and date.
LOGON Logon time and date.
CPU SECS CPU time used by this job or session (if you are in
a program, CPU time used by the program only is
shown).
CONNECT MINUTES Amount of time the current job or session has been
connected.
$STDIN LDEV Logical device number of job or session's standard
input device.
$STDLIST LDEV Standard list device number.
WELCOME... The current welcome message, if the system operator
has entered one.
Obtaining current status using predefined variables
You can obtain most of the same information by using CI predefined
variables in a command file. Doing this allows you to "customize" the
information displayed. A complete list of predefined CI variables
appears in Command Interpreter Access and Variables Programmer's Guide
(32650-90011). Use of these variables is illustrated in the following
example.
comment Command file name is "me"
echo (#!hpjobtype!hpjobnum)!hpuser.!hpaccount,!hpgroup &
LDev=!hpldevin !hpcidepth "!hpsysname" !hptimef
The results of using this command file would be
:me
(#S97)JEFF.UI,CI LDev=210 CI=1 "JOY" 5:17 PM
Obtaining job or session information with JOBINFO
The JOBINFO intrinsic performs a function similar to that of the SHOWJOB
command, returning information about the job or session that you specify.
Depending upon the task that you want to perform, and the type of
information that you want returned, you may find one more useful than the
other.
Major differences between SHOWJOB and JOBINFO are
* You can use SHOWJOB to obtain information about a job or session
other than your own. To use JOBINFO for this purpose, you need SM
capability.
* With SHOWJOB, you can use "wildcard" characters to obtain
information about a group of jobs and/or sessions. The default is
to show information about all jobs and sessions currently on the
system. With JOBINFO, you must give a specific job or session
number or a user and account name, and the information returned
pertains to the single job or session that you specified.
Table 3-1 lists the types of information that you can obtain using
SHOWJOB and JOBINFO. For specific syntax descriptions, and a detailed
outline of the information returned, consult the MPE/iX Commands
Reference Manual, Volumes 1 and 2 (32650-90003 and 32650-90364) and the
MPE/iX Intrinsics Reference Manual (32650-90028).
Table 3-1. Job and Session Status Information
-----------------------------------------------------------------------------------------------
- Information - JOBINFO - SHOWJOB -
-----------------------------------------------------------------------------------------------
- User or account name (input) - yes - no -
- Session or job name - yes - no -
- User name - yes - no -
- User's logon group - yes - no -
- User account - yes - no -
- User home group - yes - no -
- Job or session intro time - yes - yes -
- Job or session intro date - yes - day only -
- Input ldev or class name - yes - ldev only -
- Output ldev or class name - yes - ldev only -
- Current job step - yes - no -
- Current # active jobs - yes - yes -
- Current # active sessions - yes - yes -
- Job input priority - yes - yes -
- Job or session number - yes - yes -
- Jobfence - yes - yes -
- Job output priority - yes - sched jobs only -
- Number of copies - yes - no -
- Job limit (system) - yes - yes -
- Session limit (system) - yes - yes -
- Job deferred - yes - yes -
- PIN of job or session - yes - no -
- Original job-spooled - yes - no -
- RESTART option - yes - no -
- Sequenced-job - yes - no -
- Term code - yes - no -
- CPU limit - yes - no -
- Session or job state - yes - yes -
- User's local attributes - yes - no -
- $STDIN spoolfile # - yes - no -
- $STDIN spoolfile status - yes - no -
- $STDLIST spoolfile # - yes - no -
- $STDLIST spoolfile status - yes - no -
- Length of current job step - yes - no -
- SET STDLIST=DELETE invoked - yes - no -
- Job information table data segment # - yes - no -
- Job or session state information - yes - yes -
- Scheduled jobs or sessions only - no - yes -
- Intro time or date for scheduled jobs - no - yes -
-----------------------------------------------------------------------------------------------
Obtaining job or session information with predefined variables
You can also use CI predefined variables to obtain some of the same
information that you can get with SHOWJOB. The following example
illustrates the use of a command file containing CI predefined variables:
comment Command file name is "sj"
showjob job=!hpuser.!hpaccount
echo # Sessions: !hpsescount # Jobs: !hpjobcount &
# Waiting: !hpwaitj
echo (Total executing: ![hpsescount+hpjobcount])
You can run this command file with the following results:
:sj
JOBNUM STATE IPRI JIN JLIST INTRODUCED JOB NAME
#S136 EXEC 210 210 WED 7:36A JEFF.UI
JOBFENCE= 7; JLIMIT= 2; SLIMIT= 10
# Sessions: 4 # Jobs: 2 # Waiting: 2
(Total executing: 6)
Obtaining user information with WHO
The WHO intrinsic is used to obtain the access mode and other attributes
of the user who calls it. It returns the following values:
mode The current user's access mode, that is,
interactive, duplicative,chapter 2 for an
explanation of mode.)
capability User's file access attributes, user attributes, and
capability class attributes.
lattr Local attributes of the user.
usern User name.
groupn User's logon group name.
acctn User's logon account name.
homen Name of the user's home group.
term Logical device number of the job or session input
device (virtual device number if this is a spooled
job).
Example: Using WHO to test for interactive user.
Example 3-1 shows a section of code that determines whether a user is
running the program in an interactive session. If so, the PRINT portion
of the statement is executed, and a "?" is displayed on the screen to
prompt the user for a command.
________________________________________________________________
| |
| |
| PRINT (HEADING,9,0); <<PROGRAM ID |
| WHO (INTERACTIVE); <<LIVE USER? |
| LOOP: |
| IF INTERACTIVE THEN PRINT (REQ,1,%320); <<PROMPT>> |
| LGTH:=READ(INPUT,-72); <<GET CMD>> |
| IF <> THEN QUIT(1); <<ERROR CHEC |
| IF COMMAND="END" THEN GO EXIT; <<DONE - EXI |
| COMMAND(LGTH);=%15; <<CARRIAGE R |
| |
________________________________________________________________
Example 3-1. Testing for an Interactive User
Example: Using WHO to test user capabilities
Example 3-2 shows a program fragment that tests whether a user has a
certain specific capability.
_________________________________________________________________
| |
| |
| . |
| . |
| . |
| const |
| { User attributes } |
| cap_sm = 0; { System manager } |
| cap_am = 1; { Account manager } |
| cap_al = 2; { Account librarian } |
| cap_gl = 3; { Group librarian } |
| cap_di = 4; { Diagnostician } |
| cap_op = 5; { System supervisor } |
| { File access attributes } |
| cap_cv = 6; { Create volumes } |
| cap_uv = 7; { Use volumes } |
| cap_lg = 8; { User logging } |
| cap_sp = 9; { Sys proc handling } |
| cap_ps = 10; { Programm. Sessions} |
| cap_na = 11; { Network admin. } |
| cap_nm = 12; { Network manager } |
| cap_cs = 13; { Communic. systems } |
| cap_nd = 14; { Non-sharable devs } |
| cap_sf = 15; { Save files } |
| { User Capability-class Attributes } |
| cap_ba = 23; { Batch access } |
| cap_ia = 24; { Interactive acc } |
| cap_pm = 25; { Privileged mode } |
| cap_mr = 28; { Multiple RINs } |
| cap_ds = 30; { Extra data segs } |
| cap_ph = 31; { Process handling } |
| max_capset_size = 32; |
| type |
| capability_type = set of 0..max_capset_size-1; |
| var |
| user_caps : capability_type; |
| |
| procedure WHO; intrinsic; |
| |
| begin { program } |
| who( {mode}, user_caps); |
| { to see if the user has AM...} |
| if cap_am in user_caps then |
| { etc. } |
| end. { program } |
| |
_________________________________________________________________
Example 3-2. Testing User Capabilities - WHO Intrinsic
Example: Using a command file to test user capabilities.
You can, however, perform the same function by using a command file.
Example 3-3 illustrates how to do this.
_______________________________________________________________
| |
| |
| PARM test_cap |
| COMMENT This command file (havecap) tests if the user |
| COMMENT the specified capability ("test_cap"). |
| IF pos(ups('!test_cap'),hpusercapf) <> 0 then |
| ECHO You have ![ups('!test_cap')] capability. |
| ELSE |
| ECHO You lack ![ups('!test_cap')] capability. |
| COMMENT End of HAVECAP. |
| |
_______________________________________________________________
Example 3-3. Testing User Capabilities - Command File
If a user has AM, AL, IA, PH, and SF capability, use of this command file
would produce the following results:
:havecap ia
You have IA capability.
:havecap sm
You lack SM capability.
MPE/iX 5.0 Documentation