home *** CD-ROM | disk | FTP | other *** search
/ Beter Homes & Gardens: Complete Guide to Gardening / GARDENS.BIN / gardens / index / idxvarbl.prg < prev    next >
Text File  |  1994-04-01  |  3KB  |  118 lines

  1. SET exclusive off
  2. SET safety off
  3.  
  4. SELECT 1
  5. USE d:\grdncd\gardens\index\index.dbf EXCLUSIVE
  6. ZAP
  7.  
  8. APPEND FROM d:\grdncd\gardens\ann\annvar.dbf FIELDS lstname, botan, dir
  9. REPLACE ALL section WITH "ANN" FOR section = " "
  10. APPEND FROM d:\grdncd\gardens\bul\bulvar.dbf FIELDS lstname, botan, dir
  11. REPLACE ALL section WITH "BUL" FOR section = " "
  12. APPEND FROM d:\grdncd\gardens\fru\fruvar.dbf FIELDS lstname, botan, dir
  13. REPLACE ALL section WITH "FRU" FOR section = " "
  14. APPEND FROM d:\grdncd\gardens\her\hervar.dbf FIELDS lstname, botan, dir
  15. REPLACE ALL section WITH "HER" FOR section = " "
  16. APPEND FROM d:\grdncd\gardens\ind\indvar.dbf FIELDS lstname, botan, dir
  17. REPLACE ALL section WITH "IND" FOR section = " "
  18. APPEND FROM d:\grdncd\gardens\law\lawvar.dbf FIELDS lstname, botan, dir
  19. REPLACE ALL section WITH "LAW" FOR section = " "
  20. APPEND FROM d:\grdncd\gardens\per\pervar.dbf FIELDS lstname, botan, dir
  21. REPLACE ALL section WITH "PER" FOR section = " "
  22. APPEND FROM d:\grdncd\gardens\ros\rosvar.dbf FIELDS lstname, botan, dir
  23. REPLACE ALL section WITH "ROS" FOR section = " "
  24. APPEND FROM d:\grdncd\gardens\shr\shrvar.dbf FIELDS lstname, botan, dir
  25. REPLACE ALL section WITH "SHR" FOR section = " "
  26. APPEND FROM d:\grdncd\gardens\tre\trevar.dbf FIELDS lstname, botan, dir
  27. REPLACE ALL section WITH "TRE" FOR section = " "
  28. APPEND FROM d:\grdncd\gardens\veg\vegvar.dbf FIELDS lstname, botan, dir
  29. REPLACE ALL section WITH "VEG" FOR section = " "
  30. APPEND FROM d:\grdncd\gardens\vin\vinvar.dbf FIELDS lstname, botan, dir
  31. REPLACE ALL section WITH "VIN" FOR section = " "
  32. APPEND FROM d:\grdncd\gardens\wil\wilvar.dbf FIELDS lstname, botan, dir
  33. REPLACE ALL section WITH "WIL" FOR section = " "
  34.  
  35. SET ORDER TO TAG lstname
  36. SET FILTER TO DELETED() = .F.
  37. GOTO TOP
  38.  
  39. * Housekeeping
  40. index = 1
  41. handle = 0
  42. list = ""
  43.  
  44. * SET up file handle
  45. filename = "d:\grdncd\gardens\index\index.var"
  46. IF FILE(filename)
  47.     ERASE filename
  48.     handle = FCREATE(filename)    && If not create it
  49. *    handle = FOPEN(filename,12)    && If so, open read/write
  50. ELSE
  51.     handle = FCREATE(filename)    && If not create it
  52. ENDIF
  53.  
  54. * Done for each record
  55. DO WHILE .NOT. EOF()
  56.  
  57. * Output name
  58.         =FWRITE(handle,'@name[')
  59.         =FWRITE(handle,ALLTRIM(STR(index)))
  60.         =FPUTS(handle,']')
  61.         =FPUTS(handle,ALLTRIM(lstname))
  62.  
  63. * Output botanical name
  64. *        =FWRITE(handle,'@botan[')
  65. *        =FWRITE(handle,ALLTRIM(STR(index)))
  66. *        =FPUTS(handle,']')
  67. *        =FPUTS(handle,IIF(botan=" ","None",ALLTRIM(botan)))
  68.  
  69. * Output section
  70.         =FWRITE(handle,'@type[')
  71.         =FWRITE(handle,ALLTRIM(STR(index)))
  72.         =FPUTS(handle,']')
  73.         =FPUTS(handle,ALLTRIM(section))  
  74.         
  75. * Output directory
  76. *        =FWRITE(handle,'@dir[')
  77. *        =FWRITE(handle,ALLTRIM(STR(index)))
  78. *        =FPUTS(handle,']')
  79. *        =FPUTS(handle,ALLTRIM(dir))  
  80.         
  81.         list = list + ALLTRIM(lstname) + ";"
  82.  
  83. * Increment and get next record
  84.     index = index + 1    && increment list index
  85.     SKIP    && get next record
  86.  
  87. enddo
  88.  
  89. * Output final list total
  90. =FPUTS(handle,'@total')
  91. =FPUTS(handle,ALLTRIM(STR(index-1)))
  92.  
  93. * Output list string
  94. =FPUTS(handle,'@list')
  95. =FPUTS(handle,SUBSTR(list,1,LEN(list)-1))
  96. *=FPUTS(handle,list)
  97.  
  98. CLOSE DATABASE
  99.  
  100. SELECT DISTINCT botan FROM d:\grdncd\gardens\index\index.dbf INTO DBF temp ORDER BY botan
  101.  
  102. blist = ""
  103. DO WHILE .NOT. EOF()
  104.     
  105.     blist = IIF(botan=" ",blist,blist + ALLTRIM(botan) + ";")
  106.     SKIP
  107.  
  108. ENDDO
  109.  
  110. * Output blist string
  111. =FPUTS(handle,'@blist')
  112. =FPUTS(handle,SUBSTR(blist,1,LEN(blist)-1))
  113.  
  114. * Close file
  115. =FCLOSE(handle)
  116.  
  117.  
  118.