From:	CSBVAX::MRGATE!INFO-VAX-RELAY@KL.SRI.COM@SMTP  4-JAN-1978 10:16
To:	ARISIA::EVERHART
Subj:	Re: FORCEX


Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Tue, 21 Jun 88 06:34:41 PDT
Received: from ISUMVS.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 8866; Tue, 21 Jun 88 09:34:21 EDT
Date:      Tue, 21 Jun 88 08:33:52 CDT
To:        <INFO-VAX@KL.SRI.COM>
From:      "John Hascall" <GG.SPY%ISUMVS.BITNET@CUNYVM.CUNY.EDU>
Subject:   Re: FORCEX

> Date:         Tue, 14 Jun 88 16:16:00 EDT
> Sender:       INFO-VAX Discussion <INFO-VAX@UBVM>
> From:         RVALENTI%DREW.BITNET@CUNYVM.CUNY.EDU
> Subject:      FORCEX
>
> Does anyone have a program demonstrating $FORCEX?
>
> E-MAIL RVALENTI@DREW.BITNET
>
> thanks.
> -Ross

  Here is one I use all the time, note that it accepts the PID in HEX,
and before any flames me: yes, I know VAX Pascal can read in hex--this
was written before it could.

  It also prints out some stuff, no one really cares about as well, but
so what....

-------------------------- cut here -----------------------
program forcex( input, output );

var     pid_s : packed array[1..8] of char;
    code,pid  : integer;

[ASYNCHRONOUS,EXTERNAL(SYS$FORCEX)] FUNCTION $FORCEX (
       PIDADR : INTEGER := %IMMED 0;
       PRCNAM : [CLASS_S] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR := %IMMED 0;
  %IMMED CODE : INTEGER := %IMMED 0
             ): INTEGER; EXTERNAL;

[ASYNCHRONOUS,EXTERNAL(OTS$CVT_TZ_L)] FUNCTION $CVT_HEX_INT(
  %STDESCR INPSTR : PACKED ARRAY[$Z..$X:INTEGER] OF CHAR;
         %REF VAL : INTEGER;
      %immed SIZE : INTEGER := %immed 4;
     %immed FLAGS : INTEGER := %immed 1
                 ):INTEGER; EXTERNAL;

begin
   write( 'PID> ' );                                (* who to kill? *)
   readln( pid_s );
   writeln( 'CVT=',$CVT_HEX_INT( PID_S, PID ):1 );  (* convert to decimal *)
   writeln( 'PID=',pid:1);
   write( 'CODE> ' );                               (* cond code, usually 44 *)
   readln( code );
   writeln( 'FORCEX=',$FORCEX( pid, ,code ):1 );    (* adios... *)
   writeln( 'bye bye' );
end.

