home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / rexx / familylist.rexx < prev    next >
OS/2 REXX Batch file  |  1993-10-25  |  4KB  |  140 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                            FamilyList.rexx                               */
  4. /*                                                                          */
  5. /* Written by: Peter Billing, RMB 1240, Yinnar 3869, Australia              */
  6. /*                                                                          */
  7. /* Last saved: Wednesday 29-Sep-93                                          */
  8. /*                                                                          */
  9. /* This program should LIST ALL the Families in the SCION database. The     */
  10. /* database must be running for this AREXX script to work.                  */
  11. /*                                                                          */
  12. /****************************************************************************/
  13.  
  14. /* Return the Database Name */
  15.  
  16. options results
  17. /*test = show('P','SCIONGEN')
  18. if test = 0  then
  19. say
  20. say "I am sorry to say that the SCION Genealogist database is not available."
  21. say "Please start the SCION program BEFORE using this script."
  22. say
  23. exit */
  24.  
  25. myport = "SCIONGEN"
  26. address value myport
  27. getdbname
  28. dbname = upper(result)
  29. heading = "Families in the" dbname "database on" date()
  30. output = "STDOUT"
  31. say " "
  32. writeln(output,center("This script will give you a listing of all the",80))
  33. writeln(output,center(heading,80))
  34. writech(output,"Output to Screen or File S/F ")
  35. pull out
  36. gettotalfgrn
  37. total = result
  38. writech(stdout,"Do you want a sorted list Y/N ")
  39. pull sorted
  40. if sorted = "" then sorted = "N"
  41.  
  42. if sorted = "Y" then do
  43.   file_name = "ram:sort"
  44.   open(sort_File,file_Name,"w")
  45.   do x = 1 to total
  46.     getprincipal x
  47.     a = result
  48.     getsex a
  49.     sex = result
  50.     if sex = "F" then do
  51.       getspouse x
  52.       a = result
  53.     end
  54.     getlastname a
  55.     person = upper(result)
  56.     getfirstname a
  57.     person = person result x
  58.     writeln(sort_File,person)
  59.   end
  60.   close(sort_file)
  61.   address command "c:sort ram:sort ram:sort2"
  62.   file_name = "ram:sort2"
  63.   open(sort_File,file_Name,"r")
  64. end
  65.  
  66. output = "STDOUT"
  67. code1 = "" /* Bold */
  68. code2 = "" /* Normal */
  69.  
  70. if out = "F" then do
  71.    code1 = ""  /* Bold on */
  72.    code2 = "" /* Bold off */
  73.    filename = "RAM:FamilyList_"dbname".Scion"
  74.    open(w_file,filename,"w")
  75.    output = w_file
  76.    writeln(stdout,"")
  77.    writeln(stdout,"Writing file to" filename". There are" total "Families.")
  78.    end
  79.  
  80. writeln(output,center(heading,80))
  81. writeln(output,"")
  82. writeln(output,"FGRN     Name of Principal     IRN       Name of Spouse         IRN     DATE")
  83. writeln(output, "--------------------------------------------------------------------------------")
  84. do j = 1 to total
  85. if sorted = "Y" then do
  86.   person = readln(sort_file)
  87.   x = word(person,words(person))
  88. end
  89. else do
  90.   x = j
  91. end
  92. if out = "F" then do
  93.   if j/5 = j%5 then writech(stdout,".")
  94.   if j/55 = j%55 then do
  95.     writeln(output, " IRN LASTNAME        FIRSTNAME                SEX   BIRTH     PLA  DEATH    PLA  MARRIAGES           PARENTS")
  96.     writeln(output, "-----------------------------------------------------------------------------------------------------------")
  97.   end
  98. end
  99. getprincipal x
  100. p = result
  101. MakeName(result)
  102. principal = name
  103. getspouse x
  104. s = result
  105. MakeName(result)
  106. spouse = name
  107. getsex s
  108. if result = "M" then do
  109.   temp = spouse
  110.   spouse = principal
  111.   principal = temp
  112.   t = s
  113.   s = p
  114.   p = t
  115. end
  116. getmarrydate x
  117. marrydate = result
  118.   writeln(output,right(x,3) principal right(p,3)"   "spouse right(s,3) right(marrydate,12))
  119. if out = "F" & x/5 = x%5 then writech(stdout,".")
  120.  
  121. end
  122.  
  123. if out = "F" then do
  124.   writeln(output," ")
  125.   close(w_file)
  126.   writeln(stdout,"")
  127.   writeln(stdout,"All Finished")
  128.   end
  129.  
  130. exit
  131.  
  132. MakeName:
  133. parse arg irn
  134. getlastname irn
  135. name = code1 left(result,10)code2
  136. getfirstname irn
  137. name = name left(result,15)
  138. return name
  139.  
  140.