Path: utzoo!attcan!uunet!husc6!cmcl2!nrl-cmf!ames!pasteur!ucbvax!ISUMVS.BITNET!GG.SPY
From: GG.SPY@ISUMVS.BITNET ("John Hascall")
Newsgroups: comp.os.vms
Subject: Re: FORCEX
Message-ID: <8806241815.AA13693@ucbvax.Berkeley.EDU>
Date: 21 Jun 88 13:33:52 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 48

> Date:         Tue, 14 Jun 88 16:16:00 EDT
> Sender:       INFO-VAX Discussion 
> 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.