HP 3000 Manuals

Aborting a Session Programmatically [ Process Management Programmer's Guide ] MPE/iX 5.0 Documentation


Process Management Programmer's Guide

Aborting a Session Programmatically 

Once your program has successfully created a session using the STARTSESS
intrinsic, your program no longer has any control over that session,
except to abort it using the ABORTSESS intrinsic.  The newly created
sessions runs as an independent system-managed process and is not a child
process of the process that invoked STARTSESS.

The ABORTSESS intrinsic (the programmatic equivalent to the :ABORTJOB
command) is provided to enable your program to remove (abort) a selected
session from your system.  ABORTSESS is commonly used in conjunction with
the STARTSESS intrinsic to allow your program a limited form of control
over interactive sessions located on your system.

Requirements for Using ABORTSESS 

While the ABORTSESS intrinsic does not require either the PS or the PH
capabilities, your program can successfully call ABORTSESS only if the
program is executing in a session (or job) that satisfies one or more of
the following conditions:

 *  Your session is on the System Console, or has been allowed the
    :ABORTJOB command by the Console.

 *  :JOBSECURITY has been set to LOW and one of the following three
    conditions is true:

       1.  The user and account names of your session are the same as the
           user and account names of the session to be aborted.

       2.  Your session has AM capability, and the account name of your
           session is the same as the account name of the session to be
           aborted.

       3.  Your session has SM capability.


NOTE Aborting a session or job is a last resort measure. If you must do so, make sure you abort the right one, and make every effort to warn the user first.
Identifying the Job/Session You Want Aborted The ABORTSESS takes as a required parameter the job/session number the system has associated with the session you want to abort. The STARTSESS intrinsic returns this job/session number to your program when you create the session. The JOBINFO intrinsic can also return a job/session number if you pass it the user and account names of a selected session, but if there are multiple sessions associated with the same user and account, you cannot be guaranteed that JOBINFO will return the correct job/session number. In this case, the value returned by STARTSESS is the safest value to use. An example of an ABORTSESS call is: ABORTSESS(JSID,JSNUM,JSSTATUS) The parameters specified in the example are described below: JSID Passes an integer value indicating whether the process to be aborted is a session (JSID=1) or a job (JSID=2). This parameter is necessary because session numbers and job numbers can be identical. JSNUM Passes the system-defined session number or job number of the process that is to be aborted. This value was returned by the STARTSESS intrinsic when you created the session you are now planning to abort. JSSTATUS Returns status information about the success or failure of the intrinsic call. ABORTSESS deletes the specified session or job from the system and sends a message to the standard list device ($STDLIST) of the aborted session or job: SESSION ABORTED BY SYSTEM MANAGEMENT or JOB ABORTED BY SYSTEM MANAGEMENT No abort message is sent to the System Console. The session or job is deleted from the system in a fashion similar to that described in "Deleting Processes" in Chapter 2 "Process Management Tasks" . For more information about managing jobs and sessions on MPE XL, refer to Managing Jobs and Sessions (32650-90035).


MPE/iX 5.0 Documentation