home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 326.lha / DateRequester / test < prev    next >
Text File  |  1989-12-27  |  2KB  |  79 lines

  1. /* Exercise the date requester. */
  2.  
  3. /* See the comment in uniqueport regarding Delay() and these lines.
  4. if ~show('L','rexxsupport.library') then
  5.    call addlib('rexxsupport.library',0,-30)
  6. if ~show('L','rexxarplib.library') then
  7.    call addlib('rexxarplib.library',0,-30)
  8. */
  9.  
  10. options results
  11.  
  12. portName = uniqueport()
  13.  
  14. Say "Unique port name =" portName
  15.  
  16. address value(portName)
  17.  
  18. 'getformat'
  19. Say 'The default date format is ' result '.'
  20. mydate = NULL
  21. mydate.1 = "1989"   /* Year field. */
  22. mydate.2 = "05"     /* Month field. */
  23. mydate.3 = "06"     /* Day field. */
  24. mydate.4 = "10"     /* Hour field. */
  25. mydate.5 = "20"     /* Minute field. */
  26. mydate.6 = "21"     /* Second field. */
  27.  
  28. 'setfulldate' "MYDATE";
  29. 'setformat' "DOS";
  30. 'setprompt' "Select the test date:"
  31. 'request';
  32. 'getdate'
  33. Say 'The final date value =' result'.'
  34. 'gettime'
  35. Say 'The final time value =' result'.'
  36. 'getdayname'
  37. Say 'The day name for that date is ' result'.'
  38. 'getformat'
  39. Say 'The final date format is ' result'.'
  40.  
  41. 'getfulldate' "MYDATE";
  42.  
  43. Say 'The date components are: '
  44. Say '    Year = ' mydate.1
  45. Say '   Month = ' mydate.2
  46. Say '     Day = ' mydate.3
  47. Say '    Hour = ' mydate.4
  48. Say '  Minute = ' mydate.5
  49. Say '  Second = ' mydate.6
  50. Say ' Weekday = ' mydate.7
  51. 'exit';
  52. exit
  53.  
  54. /* Create a unique rexx port name. */
  55. uniqueport:
  56. portNumber = 0
  57. do forever
  58.     testName = "mrdatereq" || portNumber
  59.     if ~show('ports', testName) then do
  60.         address command
  61.         'run' rxdatereq value(testName)
  62.         if rc ~= 0 then exit
  63.         do until show('ports', value(testName))
  64.             /* I know, this is an ugly busy-wait. I'm missing the boat
  65.                somewhere, but when I tried to use the addlib calls above,
  66.                I got the software failure / task-held requester, even
  67.                when I didn't call Delay(). I suspect that I have a name
  68.                collision with an entry in one of the libraries, but don't
  69.                know what it is.  Anyone care to elucidate? Thanks. 
  70.                 
  71.                 call Delay(25);
  72.             */
  73.         end
  74.         return value(testName);
  75.     end
  76.     portNumber = portNumber + 1
  77. end
  78.  
  79.