home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / disk_20.zip / DB3DOC_2.ZIP / DB3DOC.PRG < prev   
Text File  |  1986-02-28  |  5KB  |  135 lines

  1. * DB3DOC_2.PRG  
  2. * Author : Steve Aidikonis - AIDCOM 312/289-2390 
  3. * Created: August, 1985
  4. * Revised by Carl G. Slutter
  5. * Revised February 27, 1986 to incorporate saving of file descriptions for
  6. * future use and to permit documentation of a file containing more than 
  7. * 89 fields
  8. * Requires use of Procedure File DOCPROC.PRG
  9. * For dBASE III, this program shows the use of the COPY STRUCTURE EXTENDED
  10. * command.
  11. * This program will help document the data file of your choosing
  12. SET TALK OFF
  13. SET DELIM OFF
  14. set procedure to docproc
  15. CLEAR ALL
  16. CLEAR
  17. * the memvar BIGLOOP is the main loop - Program will keep doing it's
  18. * thing until you tell it to stop or enter an invalid file name
  19. BIGLOOP=.T. 
  20. DO WHILE BIGLOOP
  21.   CLEAR
  22.   @ 2,0 SAY "dBASE III Database Document Maker -- Revision 2"
  23.   STORE "  A I D C O M      312/289-2390  " TO CMRCL
  24.   store "  V J Consulting   (301)924-4276 " to cmrcl1
  25.   @ 4,0 GET CMRCL
  26.   @ 6,0 get cmrcl1
  27.   CLEAR GETS
  28.   RELEASE CMRCL, cmrcl1
  29.   @ 10,0 
  30.   ACCE "Please enter the database name: " TO MFILE
  31.   mem_file = mfile
  32.   STORE UPPER(MFILE)+".DBF" TO MFILE
  33.   * look for the .DBF - if it's not there, exit
  34.   IF .NOT. FILE('&MFILE')
  35.     CLEAR
  36.     @ 10,0 SAY "Data file doesn'T EXIST... EXITING."
  37.    CLEAR ALL
  38.     SET DELIM ON
  39.     RETURN
  40.   ENDIF
  41.   USE &MFILE
  42.     * take a look at the file structure before starting
  43.   DISPLAY STRUCTURE
  44.   ?
  45.   ? "====================================="
  46.   ?
  47.   ACCEPT "Press <CR> =====> " TO X
  48.   CLEAR
  49.   MDESCRIP=SPACE(30)
  50.   @ 12,33 say "W O R K I N G"
  51.   set console off
  52.   num_fields = 0
  53.   null = ""
  54.   do fileno with num_fields, null
  55.   tester = 1
  56.   do testit with num_fields, tester
  57.   set console on
  58.   clear
  59.   if file('&mem_file'+'.mem')
  60.      restore from &mem_file additive
  61.   endif
  62.   * memvar MDESCRIP allows for a 30 char. general description of the file. 
  63.   @ 5,0 SAY "File Description, &MFILE : " GET MDESCRIP
  64.   READ
  65.   * here's the biggie - STRUCTURE EXTENDED creates a database containing
  66.   * only the names, length, type and decimal spaces for your file
  67.   COPY TO DOCS STRUCTURE EXTENDED 
  68.   CLEAR
  69.   USE DOCS
  70.   GO TOP 
  71.   @ 1,1 SAY "Data File:"
  72.   @ 1,13 SAY MFILE
  73.   @ 1,33 SAY "File Descrip.:"
  74.   @ 1,49 SAY MDESCRIP
  75.   @ 2,0 SAY "_______________________________________________________"
  76.   @ 2,55 SAY "________________________"
  77.   @ 4,0 SAY "Field No.       Field Name    Type    Width    Dec."
  78.   @ 4,55 SAY "Field Description"
  79.   @ 5,0 SAY "=========       ==========    ====    =====    ===="
  80.   @ 5,55 SAY "========================="
  81.   STORE 6 TO LINE
  82.   STORE 1 TO COUNTER
  83.   * go down the list of field names to allow addition of less terse field
  84.   * descriptions
  85.   cstr = ""
  86.   do screeno with counter, cstr
  87.   * end of file? Print it!!
  88.   CLEAR
  89.   ACCEPT "Turn on the printer and press <CR> =======> " TO X
  90.   CLEAR
  91.   @ 10,0 SAY "Printing the documentation for "+MFILE
  92.   GOTO TOP
  93.   SET DEVICE TO PRINT
  94.   COUNTER=1
  95.   HEADING=.T. 
  96.   cstr=""
  97.   do printo with counter, heading, cstr
  98.   STORE LINE+1 TO LINE
  99.   @ LINE,0 SAY "_______________________________________________________"
  100.   @ LINE,55 SAY "________________________"
  101.   SET DEVI TO SCREEN
  102.   USE
  103.   * finished printing, erase the structure file 
  104.   Clear
  105.   store ' 'to yn
  106.   @ 5,5 say "Do you wish to save this listing " get yn picture "!"
  107.   read
  108.   if yn="Y"
  109.      release mfile
  110.      save to &mem_file
  111.   endif
  112.   ERASE DOCS.DBF
  113.   EJECT
  114.   CLEAR
  115.   * check to see if there are any more files you wish to document
  116.   STORE ' ' TO ANS
  117.   DO WHILE AT(ANS,'YN')=0
  118.     @ 10,0 SAY "Do you wish to document another Database? ===> " ;
  119.     GET ANS PICT '!'
  120.     READ
  121.   ENDDO
  122.   * if not, exit the loop and the program
  123.   IF ANS='N'
  124.     STORE .F. TO BIGLOOP
  125.     close procedure
  126.   ENDIF
  127. ENDDO
  128. @ 10,0 
  129. @ 10,0 SAY "THAT'S ALL FOLKS!"
  130. SET DELIM ON
  131. RETURN
  132. ********* END OF FILE
  133. *******************************************************************