home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 36 Tips / 36-Tips.zip / osotrx40.txt < prev    next >
Text File  |  1997-03-24  |  3KB  |  90 lines

  1. OSOTRX40 - REX0040 ERROR WHEN USING THE REXX TIME() FUNCTION
  2. 04/26/96
  3.  
  4. =======================================================================
  5.            REX0040 Error when Using the REXX Time() Function
  6. =======================================================================
  7.  
  8. Please Read Entire Document for Full Explanation of Procedure
  9. -------------------------------------------------------------
  10.  
  11. DESCRIPTION
  12.  
  13. When a REXX Time("E") or Time("R") function is issued, the following
  14. error message is received:
  15.  
  16.    REX0040 Incorrect call to routine.
  17.  
  18. Time("R") will reset the timer clock, and Time("E") will return the time
  19. elapsed since the last reset.
  20.  
  21. This problem usually occurs in programs that log on to multiple local 
  22. area network (LAN) domains and then try to record the amount of time 
  23. spent on each logon; however, the problem also can occur on any system 
  24. that resets the timer or checks the elapsed time.
  25.  
  26.  
  27. RESOLUTION
  28.  
  29. Make sure the current system time is not earlier than the last reset.
  30.  
  31. For example, consider a large LAN/WAN (wide area network) environment 
  32. with multiple domains. The failing program logs on to multiple domains,
  33. does whatever it needs to do, and then records the time spent on that 
  34. logon into a log file. The program loops through logging on to each 
  35. domain, which looks (conceptually) something like the following.
  36.  
  37. Note: This is not actual code.
  38.  
  39. Server.1 ... Server.n
  40.  
  41.  
  42.    Do 
  43.      Logon to Server.n        /* Server resets the time  */
  44.      Call Time "R"            /* Resets the timer, Time  */
  45.      Call CopyFiles
  46.      ElapsedTime = Time("E")  /* Gets the elapsed time fine */
  47.    Loop
  48.  
  49. This is what can happen:
  50.  
  51. 1. The logon to Server.n sets the clock to 2 p.m.
  52.  
  53. 2. The Timer is reset to 2 p.m.
  54.  
  55. 3. Files are copied.
  56.  
  57. 4. Elapsed time is called at 2:10; Current Time is compared to the time
  58.    stored when the Reset was done at 2 p.m.; the time returned to the
  59.    ElapsedTime variable is 10 minutes.
  60.  
  61. 5. The program loops to the next Server.n.
  62.  
  63. 6. This Server.n (the next server in the array) sets the time to 1 p.m.,
  64.    which is earlier than the 2 p.m. stored with the Reset.
  65.  
  66. 7. Time "R" is called to reset the time and return the elapsed time from
  67.    the last reset; however, the time is now a negative number, which
  68.    causes the REX0040 error because the function cannot handle negative
  69.    time.
  70.  
  71. Possible solutions are:
  72.  
  73. * Do not query the current Time().
  74.  
  75. * If the current Time() is less than the last reset time, do not do a
  76.   comparison.
  77.  
  78. * If running on a requester, turn off the requester's
  79.   time-synchronization function.
  80.  
  81. ______________________________________________________________________
  82. IBM disclaims all warranties, whether express or implied, including 
  83. without limitation, warranties of fitness and merchantability with 
  84. respect to the information in this document. By furnishing this 
  85. document, IBM grants no licenses to any related patents or copyrights.  
  86. Copyright (c) 1994, 1996 IBM Corporation. Any trademarks and product 
  87. or brand names referenced in this document are the property of their 
  88. respective owners. Consult your product manuals for complete trademark 
  89. information.
  90.