[INHERIT('sys$library:starlet', 'sys$library:pascal$lib_routines')] PROGRAM Use_Process_Scan(OUTPUT); TYPE Item_List_Cell = RECORD CASE INTEGER OF 1: ( { Normal Cell } Buffer_Length : [WORD] 0..65535; Item_Code : [WORD] 0..65535; Buffer_Addr : UNSIGNED; Return_Addr : UNSIGNED ); 2:( { Terminator } Terminator : UNSIGNED ); END; Item_List_Template(Count:INTEGER) = ARRAY [1..Count] OF Item_List_Cell; VAR Item_List : Item_List_Template(2); Prefix : [VOLATILE] VARYING [32] OF CHAR; Process_Name : [VOLATILE] VARYING [32] OF CHAR; Context : UNSIGNED; Status : INTEGER; IOSB : ARRAY [1..2] OF INTEGER; BEGIN { Find all the process on the system with process names } { starting with DECW. } Prefix := 'DECW'; { Ask for scan on process name. $PROCESS_SCAN uses the Return_Addr } { item list field as item flags and not for a return address. } Item_List[1].Buffer_Length := LENGTH(Prefix); Item_List[1].Item_Code := PSCAN$_Prcnam; Item_List[1].Buffer_Addr := IADDRESS(Prefix.Body); Item_List[1].Return_Addr := PSCAN$M_Prefix_Match; { Terminate the item list } Item_List[2].Terminator := 0; Status := $process_scan(Context,Item_List); IF NOT ODD(Status) THEN LIB$Stop(Status); { Set up itemlist for retrieving process information. } Item_List[1].Buffer_Length := SIZE(process_name.body); Item_List[1].Item_Code := JPI$_Prcnam; Item_List[1].Buffer_Addr := IADDRESS(Process_Name.Body); Item_List[1].Return_Addr := IADDRESS(Process_Name.Length); { Terminate the item list } Item_List[2].Terminator := 0; REPEAT Status := $getjpiw(Itmlst := Item_List, Pidadr := Context, IOSB := IOSB); IF ODD(Status) THEN Status := IOSB[1]; IF ODD(Status) THEN WRITELN('Process name: ',Process_Name) ELSE IF Status <> SS$_NOMOREPROC THEN LIB$Stop(Status); UNTIL Status = SS$_NOMOREPROC; END.