home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 10 / Fresh_Fish_10_2352.bin / new / biz / dbase / quickfile / arexx / demo.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-06-30  |  3.0 KB  |  127 lines

  1. /*
  2.     Demo ARexx script for QuickFile
  3.  
  4.     Author: Alan Wigginton
  5.     Date:   21 March 1995
  6. */
  7.  
  8. options results     /* required to make result string available */
  9.  
  10. if ~open("con","CON:20/10/400/100/ARexx/CLOSE","W") then
  11.     exit 20
  12.  
  13. call writeln("con", "QuickFile ARexx script demo")
  14. call writeln("con", "This requires that QuickFile be running with")
  15. call writeln("con", "the demo AddressBook file open. If necessary")
  16. call writeln("con", "open the file now")
  17. call writeln("con", "Enter y to continue, anything else to end")
  18. if upper(readln("con")) ~= "Y" then
  19.     exit
  20.  
  21. if ~show(ports,"QUICKFILE.01") then
  22.     call ErrorProc "QuickFile.01 port not found"
  23.  
  24. address "QUICKFILE.01"
  25.  
  26. "setfile AddressBook"
  27. "wintofront"        /* make sure user can see the window */
  28.  
  29. /*
  30.     Display a simple message in a requester
  31.     --------------------------------------
  32. */
  33.  
  34. "reqmsg 'OK - Lets load a list style view'"
  35.  
  36. /*
  37.     Load a new view and redraw display according to the view
  38.     --------------------------------------------------------
  39. */
  40.  
  41. "setview"
  42. if result ~= "AddrList.view" then
  43. do
  44.     "setview AddrList.view"
  45.     if rc = 5 then
  46.     do
  47.     "loadview AddrList.view"
  48.     if rc > 0 then
  49.         call ErrorProc "Error loading AddrList.view"
  50.     end
  51.     "setview AddrList.view"
  52. end
  53.  
  54. "reqmsg 'Few database programs have a good list display'"
  55.  
  56. /*
  57.     Here is a simple search of the database. The matching records
  58.     are placed in an index named 'Selected'
  59.     The 'refresh' command causes an immediate redraw of the display.
  60.     Without it, the display is not updated until the macro finishes
  61. */
  62.  
  63. "reqmsg 'Now lets find all the Smiths using sounds like'"
  64.  
  65. "newsearch Lastname sounds smith"        /* set search criteria  */
  66. "dosearch"                              /* find all the records */
  67. numfound   = result            /* returns number found */
  68. "setindex selected"                     /* Use the selected index */
  69. "refresh"
  70.  
  71. /* sends reqmsg 'We found x Smiths' to QuickFile */
  72. /* quotes can be tricky         */
  73.  
  74. "reqmsg 'We found" numfound "names that sound like Smith'"
  75.  
  76. "reqmsg 'Now a sort over country and name'"
  77. "setindex name"             /* swap back to a full list */
  78. "sort country a lastname a firstname a"
  79. "refresh"                   /* and show the result  */
  80. "reqmsg 'Here is the sorted list'"
  81.  
  82. /*
  83.     Now lets do some printing
  84.     -------------------------
  85. */
  86.  
  87. "reqmsg 'Lets print a total of records by country - to the screen'"
  88. "next -9999"
  89. "report -1 screen 'This title inserted from ARexx'"
  90.  
  91. "reqmsg 'Now lets print some address labels'"
  92.  
  93. "setindex name"
  94.  
  95. "setview AddrLabels.view"
  96. if rc = 5 then
  97. do
  98.     "loadview AddrLabels.view"
  99.     if rc > 0 then
  100.     call ErrorProc "Error loading AddrLabels.view"
  101.     "setview AddrLabels.view"
  102. end
  103.  
  104. "next -9999"
  105. "report -1 screen"
  106.  
  107. "reqchoice 'This is a choice requester' 'Press a button'"
  108. if rc = 5 then
  109.     "reqmsg 'You chose Cancel'"
  110. else
  111.     "reqmsg 'You chose OK'"
  112.  
  113. "reqmsg 'Thats all. Please excuse all the requesters'"
  114. exit
  115.  
  116. ErrorProc:
  117.  
  118. arg msg
  119.  
  120. call writeln("con", msg)
  121. call writeln("con", "Press return to continue")
  122. call readln("con")
  123. exit
  124.  
  125.  
  126.  
  127.