home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxps17.zip / ps.cmd next >
OS/2 REXX Batch file  |  1993-04-29  |  2KB  |  45 lines

  1. /* PS.CMD - OS/2 - Display equivalent to unix 'ps' command.
  2. ┌──────────────┬───────────────┬───────────────────────────────────────────┐
  3. │ REXX PS v1.7 │ Peter Gamache │ 3076 Mississippi St, Saint Paul, MN 55112 │
  4. ╞╦╦╦╦══════════╧═══════════════╧════════╦╦╦╦╦╦╦═══════════════════════╦╦╦╦╦╡
  5. ╞╬╬╬╣ Copyright October 1992, P Gamache ╠╬╬╬╬╬╣ Use at your own risk! ╠╬╬╬╬╡
  6. └╨╨╨╨───────────────────────────────────╨╨╨╨╨╨╨───────────────────────╨╨╨╨╨┘
  7. * Donate money if you wish, this is kindware, you CANNOT sell it.         *
  8. * To see more of my rexx scripts, call: Duonet/The Edge @ (612)636-2155   */
  9.  
  10. say ''
  11. arg args
  12. if args \="" then do
  13.   do x=2 to 6
  14.     say sourceline(x)
  15.   end
  16.   say '┌──────────────── Shell Number'
  17.   say '│   ┌──────────── Process ID'
  18.   say '│   │    ┌─────── Parent Process ID'
  19.   say '│   │    │    ┌── Process Priority'
  20. end
  21. say 'SN PID  PPID PRTY Name'left('',41)'BlockID  Status' /* Our Title   */
  22. if queued()=0 then signal GetData   /* If queue is empty, don't dawdle  */
  23.  
  24. MTDQ:                               /* Empty the queue...               */
  25. do forever                          /* Operation(MTDQ) Loop             */
  26.   if queued()=0 then leave          /* If queue = empty, we're done     */
  27.   LINE=linein('QUEUE:')             /* set dummy variable & pull line   */
  28. end                                 /* end operation(MTDQ) loop         */
  29.  
  30. GetData:            /* Let's get the info from PSTAT.EXE                */
  31. 'pstat /c|rxqueue'  /* Not too tough to exec a command, is it?          */
  32.  
  33. ParseLoop:          /* Pull lines off the queue and clean them up       */
  34. do forever                               /* Operation(PARSE) loop       */
  35.   if queued()=0 then leave               /* if QUEUE empty, we're done  */
  36.   parse value linein('QUEUE:') with LINE /* set variable & fetch a line */
  37.   if pos('EXE',LINE)=0 then iterate      /* if no 'EXE', then skip      */
  38.   parse value LINE with X1 X2 X3 X4 XX1 X5 X6 X7 XX2  /* Break it down  */
  39.   if X4='C:\OS2\PSTAT.EXE' then iterate  /* Let's not list pstat.exe    */
  40.   X4=left(X4,44)                         /* force X4 to proper length   */
  41.   say X3 X1 X2 X5 X4 X6 X7
  42. end                                      /* end of operation(PARSE) loop*/
  43.  
  44. exit 0                                   /* We're done!                 */
  45.