home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / rexx / fixplacenames.rexx < prev    next >
OS/2 REXX Batch file  |  1993-10-24  |  3KB  |  123 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                          FixPlaceNames.rexx                              */
  4. /*                                                                          */
  5. /* Written by: Peter Billing, RMB 1240, Yinnar 3869, Australia              */
  6. /*                                                                          */
  7. /* Last saved: Wednesday 29-Sep-93                                          */
  8. /*                                                                          */
  9. /* This script should FIND and REPLACE a given PLACE name in the SCION      */
  10. /* database. It will check Birth, Death, Burial and Marriage place names.   */
  11. /*                                                                          */
  12. /****************************************************************************/
  13.  
  14. options results
  15. /*test = show('P','SCIONGEN')
  16. if test = 0  then
  17. say
  18. say "I am sorry to say that the SCION Genealogist database is not available."
  19. say "Please start the SCION program BEFORE using this script."
  20. say
  21. exit */
  22.  
  23.  myport = "SCIONGEN"
  24. address value myport
  25. getdbname
  26. dbname = upper(result)
  27. f = "STDOUT"
  28. say ""
  29. say "Current database name is " dbname
  30. say
  31. say "This script will FIND and REPLACE Birth, Death, Burial"
  32. say "and Marriage place names with a new one supplied by you."
  33. say "Just press RETURN to exit."
  34. say
  35. writech(f,"What PLACE name you would like replaced? ")
  36. pull findname
  37. if findname = "" then exit
  38. capit(findname)
  39. findname = new
  40. say
  41. say "EVERYTHING after and including" findname "will be deleted"
  42. writech(f,"What is the replacement PLACE name? ")
  43. pull replacename
  44. say
  45. capit(replacename)
  46. replacename = new
  47.  
  48. gettotalirn
  49. total = result
  50. z = total*3
  51. gettotalfgrn
  52. z = z + result
  53. writeln(f,"Hang on a moment. There are" z "place names to check.")
  54. t=0
  55. do x = 1 to total
  56.   getbirthplace x
  57.   call fixplace(result)
  58.   putbirthplace x name
  59.   getdeathplace x
  60.   call fixplace(result)
  61.   putdeathplace x name
  62.   getburialplace x
  63.   call fixplace(result)
  64.   putburialplace x name
  65.   if x/5 = x%5 then writech(stdout,".")
  66. end
  67. say
  68. say "I changed a total of "t" birth, death and burial places"
  69.  
  70. gettotalfgrn
  71. total = result
  72. t=0
  73. do x = 1 to total
  74.   getmarryplace x
  75.   call fixplace(result)
  76.   marryplace = name
  77.   putmarryplace x marryplace
  78.   if x/5 = x%5 then writech(stdout,".")
  79. end
  80. say
  81. say "and I also changed "t" marriage places"
  82. say
  83. say "Do not forget to SAVE the new" dbname "database."
  84. say
  85. exit
  86.  
  87. fixplace:
  88. parse arg name
  89. a = 0
  90. a = pos(findname,name)
  91. if a > 0 then do
  92.    name = delstr(name,a)
  93.    name = insert(replacename,name,a-1)
  94.    t = t + 1
  95. end
  96. return name t
  97.  
  98. capit:
  99. parse arg w
  100. new = ""
  101.  new = insert(new , upper(substr(w,1,1)))
  102.   do j = 2 to length(w)
  103.     p = substr(w,j,1)
  104.     if substr(w,j-1,1) = " " then do
  105.       new = insert(new , upper(p))
  106.     end
  107.     else do
  108.     if substr(w,j-1,1) = "      " then do
  109.       new = insert(new , upper(p))
  110.     end
  111.     else do
  112.     if datatype(p,upper) then do
  113.       x = c2d(p)+32
  114.       new = insert(new , d2c(x))
  115.     end
  116.     else
  117.       new = insert(new , p)
  118.     end
  119.   end
  120.   end
  121. return new
  122.  
  123.