home *** CD-ROM | disk | FTP | other *** search
/ RBBS in a Box Volume 1 #2 / RBBS_vol1_no2.iso / 003z / ddprint.prg < prev    next >
Text File  |  1986-04-11  |  4KB  |  128 lines

  1. * ╔══════════════════════════════════════════════════════════════════════╗
  2. * ║                           DDPRINT.PRG                                ║
  3. * ╠══════════════════════════════════════════════════════════════════════╣
  4. * ║                                                                      ║
  5. * ║                  Author: Gene Clark  (202)252-6363                   ║
  6. * ║                     Created: October 20, 1985                        ║
  7. * ╚══════════════════════════════════════════════════════════════════════╝
  8. *
  9. *   This program prints the data dictionary of your designated dBASEIII
  10. *   file, contained in the *.DIC file created by the DDGEN.PRG command
  11. *   file.  You supply the dBASEIII data file name, and this program supplies
  12. *   the rest.
  13. *
  14. SET TALK OFF
  15. SET DELIM OFF
  16. CLEAR ALL
  17. CLEAR
  18. ACTIVE=.T.
  19. DO WHILE ACTIVE
  20.   CLEAR
  21.   @ 1,10 SAY "╔══════════════════════════════════════════════════════╗"
  22.   @ 2,10 SAY "║       dBASE III Database Data Dictionary Printer     ║"
  23.   @ 3,10 SAY "╚══════════════════════════════════════════════════════╝"
  24.   @ 5,3 SAY " This program prints the dBASEIII data dictionary for a data file you"
  25.   @ 6,3 SAY " specify.  The data dictionary is actually a dBASEIII data base file"
  26.   @ 7,3 SAY " with the same filename as your data file, but with an extent of .DIC ."
  27.   @ 8,3 SAY " Once a .DIC file is created, it can be USEd like any .DBF file as"
  28.   @ 9,3 SAY " long as you USE it with the fully qualified name.  You will be asked"
  29.   @ 10,4 SAY "to provide the dBASEIII data base file name; the program will find"
  30.   @ 11,4 SAY "the associated .DIC file and print or display the data dictionary"
  31.   @ 12,4 SAY "information."
  32.   @ 14,0
  33.   ACCE "          Please enter the database name: " TO NFILE
  34.   NFILE = UPPER(NFILE)
  35.   DFILE = NFILE+".DIC"
  36.   MFILE = NFILE+".DBF"
  37.   @ 16,0 CLEAR
  38.   * look for the .DIC - if it's not there, exit
  39.   IF .NOT. FILE('&DFILE')
  40.     @ 15,10 SAY "File &DFILE doesn't exist... EXITING."
  41.     SET DELIM ON
  42.     RETURN
  43.   ENDIF
  44.   USE &DFILE
  45.   DEFN = DEFINITION
  46.   CLEAR
  47.   WAIT "Display or Print the data dictionary?" TO P
  48.   P=UPPER(P)
  49.   @ 1,0 CLEAR
  50.   IF P = "P"
  51.    ACCEPT "Turn on the printer and press <CR> =======> " TO X
  52.    CLEAR
  53.    @ 10,20 SAY "Printing the data dictionary for "+MFILE
  54.    SET DEVICE TO PRINT
  55.   ENDIF
  56.   COUNTER=1
  57.   HEADING=.T.
  58.   GO 2
  59.   DO WHILE .NOT. EOF()
  60.     IF HEADING
  61.       @ 1,0 SAY "dBASEIII DATA BASE FILE DICTIONARY"
  62.       @ 1,57 SAY "Today's Date:"
  63.       @ 1,71 SAY DATE()
  64.       @ 3,0 SAY "Data File: " + MFILE
  65.       @ 3,40 SAY "Dictionary File: " + DFILE
  66.       @ 4,0 SAY "File Description: " + DEFN
  67.       @ 5,0 SAY "======================================================="
  68.       @ 5,55 SAY "========================"
  69.       @ 6,0 SAY "Num Field Name T Len Dec"
  70.       @ 6,45 SAY "Field Definition"
  71.       @ 7,0 SAY "=== ========== = === ==="
  72.       @ 7,25 SAY "======================================================"
  73.       LINE=8
  74.       HEADING=.F.
  75.     ENDIF
  76.     @ LINE,0  SAY NUM
  77.     @ LINE,4  SAY FIELD_NAME
  78.     @ LINE,15 SAY T
  79.     @ LINE,17 SAY LEN
  80.     @ LINE,21 SAY DEC
  81.     @ LINE,25 SAY DEFINITION
  82.     SKIP
  83.     LINE = LINE+1
  84.     COUNTER = COUNTER+1
  85.     IF (LINE>56.AND.P="P")
  86.       HEADING=.T.
  87.       EJECT
  88.     ENDIF
  89.     IF (LINE>23.AND.P<>"P")
  90.       HEADING=.T.
  91.       WAIT "               Hit any key to continue" TO X
  92.       CLEAR
  93.     ENDIF
  94.   ENDDO
  95.   STORE LINE+1 TO LINE
  96.     IF (LINE> 23.AND.P<>"P")
  97.        CLEAR
  98.        LINE = 5
  99.     ENDIF
  100.   @ LINE,0 SAY "_______________________________________________________"
  101.   @ LINE,55 SAY "________________________"
  102.   IF P<>"P"
  103.       WAIT "      Last of Dictionary Lines --  Hit Any Key to Continue" TO X
  104.   ENDIF
  105.   SET DEVI TO SCREEN
  106.   * finished printing
  107.   IF P = "P"
  108.    EJECT
  109.   ENDIF
  110.   CLEAR
  111.   * check to see if there are any more files to be printed
  112.   STORE ' ' TO ANS
  113.   DO WHILE AT(ANS,'YN')=0
  114.     @ 10,0 SAY "Do you wish to print another database dictionary ? " ;
  115.     GET ANS PICT '!'
  116.     READ
  117.   ENDDO
  118.   * if not, exit the loop and the program
  119.   IF ANS='N'
  120.     STORE .F. TO ACTIVE
  121.   ENDIF
  122. ENDDO
  123. @ 10,0
  124. @ 10,18 SAY "Data Dictionary(ies) Printed -- Job Finished"
  125. SET DELIM ON
  126. RETURN
  127. ********* END OF FILE
  128.