home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxusmp.zip / PROGRESS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-04-08  |  2KB  |  45 lines

  1. /* Rexx */
  2.  
  3. /*******************************************************************
  4.   
  5.   The following swatch of Rexx code illustrates how you might use
  6.   some functions in the YDBAUTIL function package to do multi-
  7.   threaded Rexx programming.
  8.  
  9.   In the example below, we are going to display a "progress" message
  10.   to show some sign of life to a user while the program waits on
  11.   some external event.  In this case, we just want to display a
  12.   "counter" on the screen while the main thread is waiting for
  13.   a user to press any key to release the "pause" command.
  14.  
  15. *******************************************************************/
  16.  
  17. /* Register Rexx external functions */
  18. If RxFuncQuery('SYSSLEEP') Then
  19.   Do
  20.   Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  21.   Call SysLoadFuncs
  22.   End
  23. If RxFuncQuery('RxCreateRexxThread') Then
  24.   Do
  25.   Call RxFuncAdd 'RxYdbaUtilInit','YDBAUTIL','RxYdbaUtilInit'
  26.   Call RxYdbaUtilInit
  27.   End
  28.  
  29. /* InStorage code to be executed on another thread while waiting for */
  30. /* response from partner */
  31. instr = "Say;Say 'Executing instruction(s) at partner LU';Say"
  32. instr = instr || ";Say 'Waiting for external event to end ...'"
  33. instr = instr || ";call time 'r';do forever;call syssleep 2;call charout ,'0d'x||Trunc(time('e')) 'Seconds elapsed';end"
  34. instr = RxTokenize(instr)
  35.  
  36. tid = RxCreateRexxThread('&'instr)
  37.  
  38. /* ... perform something which waits on an external event */
  39. '@pause'
  40. /* ... (such as an APPC "Receive_And_Wait", etc.)         */
  41.  
  42. call rxkillthread tid;say
  43.  
  44. Exit
  45.