/* dblist.p Database schema listing utility. BY: Tris Hopkins - tris@lek.net http://lek.net/~tris March, 2001 */ def NEW SHARED var savefname like _file._file-name no-undo. def var saveiname like _index._index-name no-undo. def NEW SHARED var show_labels as log format "Y/N" no-undo. def var paginate as log format "Y/N" no-undo. def var porf as log format "P/F" no-undo. def var yn as log format "Y/N" init True no-undo. def var ofname as cha format "x(30)" no-undo. def NEW SHARED var sub_title as cha format "x(70)" no-undo. def NEW SHARED var sfile as cha format "x(20)" label "First Table" INIT "aaaaaaaaaaaaaaa" no-undo. def NEW SHARED var efile as cha format "x(20)" label "Last Table" INIT "zzzzzzzzzzzzzzz" no-undo. DEF NEW SHARED VAR from-field AS CHA FORMAT "x(30)" LABEL "From Field" INIT "aaaaaaaaaaaaaaa" NO-UNDO. DEF NEW SHARED VAR to-field AS cha FORMAT "x(30)" LABEL "To Field" INIT "zzzzzzzzzzzzzzz" NO-UNDO. def NEW SHARED var tot_files as int format ">>,>>9" label "Total Files" no-undo. def NEW SHARED var file_count as int format ">>,>>9" label "Files" no-undo. def NEW SHARED var field_count as int format ">>,>>9" label "Fields" no-undo. DEF NEW SHARED VAR i AS INT NO-UNDO. form skip(1) file_count colon 20 label "File Count" skip(1) field_count colon 20 label "Field Count" skip(1) with center row 2 side-labels title " DB Schema Listing " frame fcount_fr. form skip(1) sfile colon 15 help "Starting table name" efile colon 15 help "Ending table name" skip(1) from-field COLON 15 to-field COLON 15 SKIP(1) show_labels colon 15 label "Labels?" help "Print field label strings (Y/N)" paginate colon 15 label "Paginate?" help "Page breaks in output (Y/N)" skip(1) with width 50 center side-labels title "DB Dump" frame dump_setup. do on endkey undo, leave: update sfile efile from-field to-field show_labels paginate with frame dump_setup. end. hide frame dump_setup. if keyfunc(lastkey) = "END-ERROR" then return. message "Send Output To ile or

rinter?" update porf. hide message no-pause. def NEW SHARED stream s. ofname = "\temp\dblst.txt". if not porf then do: message "Enter file name:" update ofname. hide message no-pause. if search(ofname) <> ? then do: message "File already exists. Overwrite?" update yn. hide message no-pause. if not yn then return. end. if paginate = TRUE then output stream s to value(ofname) paged page-size 58. else output stream s to value(ofname). end. else do: if paginate then output stream s to printer paged page-size 58. else output stream s to printer page-size 0. end. REPEAT i = 1 TO NUM-DBS: IF LDBNAME(i) = ? THEN LEAVE. ELSE ASSIGN sub_title = ldbname(i) sub_title = fill(" ", 35 - integer(length(sub_title) / 2)) + sub_title. DISP STREAM s sub_title NO-LABELS. PAUSE 0. RUN find_field1.p sub_title. END. DISP file_count field_count "" @ _file._file-name with frame fcount_fr. disp stream s skip(1) file_count field_count. output stream s close.