Please enable JavaScript to view this site.

Updated May 2015; see History

KILL <jobname> {/k}{/y}

KILL is similar to, but more complex than, its AMOS counterpart, and works differently depending on whether you are running under Windows or Unix. The additional complexity arises from the dual nature of jobs running under A-Shell. (Such jobs have both an A-Shell/AMOS nature and an underlying Windows or Unix process nature.) It also arises from the fact that, unlike the AMOS counterpart, this version of KILL actually tries to clean up resources left in limbo by the target process.

For Unix, KILL starts by checking if the underlying Unix process still exists. (Under extreme circumstances, it may be possible to abort a Unix process without A-Shell realizing it; thus leaving a phantom job in the A-Shell job table.) If the Unix process no longer exists, it offers to clean up the resources (file locks and other queue blocks) still associated with the job. Otherwise, it sends a trappable kill signal (SIGINT, same as Ctrl+C sends) to the target process and waits a few seconds to see if the job goes away. If so, then we are done. If the process does not go away (possibly because the of insufficient privileges) then this fact is reported and nothing further can be done, unless the /K switch was specified. With /K, and provided that the user is logged into the OPR: account, it will then proceed to use a stronger (but still trappable) kill signal (SIGTERM) to abort the underlying Unix process (causing an ASB error 251 in the aborted program). Once this is complete, it checks to see if the job left any resources locked in the qflock.sys or jobtbl.sys files. If so, it prompts you to confirm whether you want them cleaned up.

The /Y switch will assume that the answer to this question is "Y", allowing it to be used in unattended processes. An example of where you might want to use this is in a nightly processing routine that requires all users to be either logged out or at least at a known menu. This could be accomplished (under Unix) by executing SYSTAT.LIT/L, and then reading the resulting systat.lst file and checking to see which jobs are not in the proper state. Then a command file using KILL <job> for each such job can be generated and executed. Without the /K/Y arguments to KILL, it would only have the effect of forcing a Ctrl+C to these jobs. Since this might not be sufficient to force the wayward jobs out of their programs, you could use KILL <job> /K /Y. Or if you want to really be fancy, you could try it first without the /K /Y, then run another SYSTAT to see if it succeeded, and only then use KILL /K /Y on the stragglers.

Because of Unix security rules, it is impossible for one user to send signals to another unless the first user has superuser privileges, or unless they are both sharing the same effective user ID. Refer to File Ownership and Privileges for help on achieving this, or on setting the SETUID bit on ashkill so that it runs with root privileges.

Under Windows, KILL uses the A-Shell Inter Job Communication (IJC) system to send a message to the target job, effectively telling it, in as friendly a manner as possible, to go kill itself. As with the Unix version described above, the /K switch determines how lethal the operation is. Without /K, it is basically no different than a Ctrl+C (which may be trapped by the program, or ignored entirely). With /K, the instructions are to abort anything that is running, even VUE. (It is nice enough to save the file first though.) If an ASB program is running at the time, it will be aborted with error 251 (which can be trapped, but only temporarily, because as soon as the program goes into a keyboard operation it will terminated without any further delay). Note that the IJC system clock frequency is established by the IJCFREQ parameter in miame.ini.

History

2017 January, A-Shell 6.3.1542:  Updated to support localization; see LITMSG.xxx 039,### for message customization.

2015 May, A-Shell 6.1.1408:  Updated routine to recognize and preserve a new unique identifer field in the JOBTBL. The new version is backward compatible with earlier versions of A-Shell and has a "B" in the version number to help easily identify it.

Created with Help+Manual 9 and styled with Premium Pack Version 5 © by EC Software