home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / I265.ZIP / qtime.cmd < prev    next >
OS/2 REXX Batch file  |  1992-08-05  |  822b  |  32 lines

  1. /* QTIME.CMD - Use EHLLAPI to get date and time from VM system */
  2.  session = 'A'
  3.  call RxFuncAdd 'HLLAPI','SAAHLAPI','HLLAPISRV'
  4.  rc = hllapi('Connect', session) if rc \= 0 then do
  5.      say 'Did not connect to host RC='rc
  6.      signal quit
  7.  end
  8.  
  9.  rc = hllapi('Wait') if rc \= 0 then do
  10.      say 'Host keyboard locked.'
  11.      signal quit
  12.  end
  13.  
  14.  rc = hllapi('Sendkey', '@C')
  15.  rc = hllapi('Wait')
  16.  rc = hllapi('Sendkey', 'CP Query Time @E')
  17.  rc = hllapi('Wait')
  18.  pos = hllapi('Search_ps', 'TIME IS ', 1)
  19.  if pos=0 then do
  20.      say 'Host could not process QUERY TIME command'
  21.      signal quit
  22.  end
  23.  
  24.  time = hllapi('Copy_ps_to_str', pos + length('TIME IS '), 8)
  25.  say time
  26.  rc = hllapi('Sendkey', '@C') rc = hllapi('Wait')
  27.  
  28. quit:
  29.     call hllapi('disconnect')
  30.     call hllapi('reset_system')
  31. return
  32.