!+ ! FORCEX ! ! Author : Nick de Smith ! Creation date : 24 April 1988 ! ! Trivial program to force another process to exit with a nice status. ! Good for stopping locked up programs without deleting the process. ! ! Edit Edit date By Why ! 01 24-Apr-88 NMdS First attempt !- Program FORCE_EXIT Option Type = Explicit , ! Force explicit variable declaration & Constant Type = Integer , ! Default all constants to INTEGER... & Handle = Error , ! Handle non-basic errors up to -E- & Size = Integer Long ! ...and make the integer size LONG %Include "$SSDEF" %From %Library %Include "$STSDEF" %From %Library External Long Constant & BAS$K_ENDFILDEV ! End of file on device External Long Function & SYS$FORCEX( optional long, string, long by value ), ! Force process to exit & OTS$CVT_TZ_L( string, long, optional long by value, long by value ) ! Convert HEX to binary Declare & String T_Process_PID , ! Process PID to use (as a string) & Long L_Process_PID , ! Process PID to use & Long L_Program_Status ! Exit status of this program When Error In L_Program_Status = Not STS$M_SUCCESS ! Ensure first entry into loop Until L_Program_Status And STS$M_SUCCESS Input "Process PID: "; T_Process_PID ! Ask for a process PID L_Program_Status = OTS$CVT_TZ_L( T_Process_PID, L_Process_PID, , 1 by value ) If (L_Program_Status And STS$M_SUCCESS) = 0 Then Print "Illegal PID - Only hexadecimal characters please" End If Next L_Program_Status = SYS$FORCEX( L_Process_PID, , SS$_OPRABORT By Value ) Use Select Err ! Determine error cause case BAS$K_ENDFILDEV ! CTRL/Z at a command prompt L_Program_Status = SS$_NORMAL ! ...so just quit with success case else ! Not a BASIC error... L_Program_Status = VMSSTATUS ! ...so extract the real cause End Select End When End Program L_Program_Status