home *** CD-ROM | disk | FTP | other *** search
Wrap
INI File | 1991-08-13 | 8.2 KB | 582 lines
[ver] 4 [sty] ~macro.sty [files] [revisions] 0 [prn] PostScript Printer [lang] 1 [desc] Reads dBase files and provides field information. Creates an Ami Pro description file needed for mail merging. Lotus WPD Technical Support Advanced fopen, fread, Arrays 682119372 25 676574628 581 2 0 0 0 0 Fread, Arrays, 0 [fopts] 0 1 0 0 [lnopts] 2 Body Text 1 [docopts] 5 2 [lay] Standard 513 [rght] 15840 12240 1 1440 1440 1 1440 1440 2 1 0 1 1 2 1 1440 10800 5 1 720 1 1440 1 2880 1 4320 1 5760 [hrght] [lyfrm] 1 11200 0 0 12240 1440 0 1 3 1 0 0 0 0 0 0 0 0 1 [frmlay] 1440 12240 1 1440 0 1 270 1440 0 1 0 1 1 0 1 1440 10800 0 [txt] <+B>Peyton McManus <+B>DataGet <+B>Page <:P10,0,> > [frght] [lyfrm] 1 13248 0 14400 12240 15840 0 1 3 1 0 0 0 0 0 0 0 0 2 [frmlay] 15840 12240 1 1440 360 1 14472 1440 0 1 0 1 1 0 1 1440 10800 0 [txt] > [elay] [l1] 0 [edoc] <:#606,9360>' This macro will read dbase file header info and return the name and nubmer of fields. It is also ' capable of returning any info stored in header. ie, field defin. field length, # records Etc <:#202,9360> <:#202,9360>Function Multiple() <:#202,9360>dim a(40) <:#202,9360>doc=getdocpath$() <:#202,9360>Filledit(9001,"{doc}*.dbf") <:#202,9360>Box=dialogbox(".","import") <:#202,9360>if Box<<<;>1 <:#202,9360> Exit Function <:#202,9360>Endif <:#202,9360>Files=getdialogfield$(9001) <:#202,9360>Hourglass(on) <:#202,9360>StatusBarMsg("Please Wait...Reading dBase file info ......") <:#202,9360>dir=getcurrentdir$() <:#202,9360>'Singlestep(on) <:#202,9360>Handle=Fopen("{dir}{files}","r") <:#202,9360>for t=1 to 32 <:#202,9360> Byte=Fread(handle,1) <:#202,9360> char=asc(byte) <:#202,9360> a(t)="{char}" <:#202,9360>next <:#202,9360>Day=a(4) <:#202,9360>Month=a(3) <:#202,9360>Year=a(2) <:#202,9360>Records=a(5)+(256*a(6)) <:#202,9360>Bytes_Header=a(9)+(256*a(10)) <:#202,9360>Bytes_record=a(11)+(256*a(12)) <:#202,9360>Num_Fields = ((Bytes_Header - 32) / 32) <:#202,9360> <:#202,9360>Num_Fields=FormatNum$("","",0,Num_Fields) <:#202,9360>Dim Name_Field(Num_fields) <:#202,9360>Dim Combine(Num_Fields) <:#202,9360>Filledit(1001,"{Files}") <:#202,9360>Filledit(1003,"{Month}/{Day}/{Year}") <:#202,9360>Filledit(1005,Records) <:#202,9360>Filledit(1006,"{Num_Fields} Fields") <:#202,9360>FOR V = 1 TO Num_Fields <:#202,9360> Name_field(v)= FREAD(Handle,11) <:#202,9360> charType = FREAD(Handle,1) <:#202,9360> fda = FREAD(Handle,4) <:#202,9360> length = ASC(FREAD(Handle,1)) <:#202,9360> numdec = ASC(FREAD(Handle,1)) <:#202,9360> reserve = FREAD(Handle,13) <:#202,9360> odhterm = FREAD(Handle,1) <:#202,9360> Filledit(9000,Name_Field(v)) <:#202,9360> Combine(v)="{Name_Field(v)}^{CharType}^{Length}" <:#202,9360>name=Name_Field(v) <:#202,9360>View=combine(v) <:#202,9360>'Message("{v} {name} {View}") <:#202,9360>NEXT <:#202,9360>Hourglass(off) <:#202,9360>Fclose(Handle) <:#202,9360>StatusBarMsg("") <:#202,9360>Box=dialogbox(".","Dbasefun") <:#202,9360>If Box=3 <:#202,9360> New("~default.sty",Nocontents,0) <:#202,9360> Type ("dBase<[>Enter]") <:#202,9360> for F=1 to Num_fields <:#202,9360> Name=Name_Field(F) <:#202,9360> Type ("{Name}<[>Enter]") <:#202,9360> Next <:#202,9360>Endif l1="Here is a dBase description file. To use this in a merge, " l2="save the untitled as a file. For additional help, see the Ami " l3="Pro chapter on Merging Text and Data." Message("{l1}{l2}{l3}") <:#202,9360> <:#202,9360>END FUNCTION <:#202,9360> <:#202,9360> <:#202,9360>DIALOG Import <:#202,9360>-2134376448 5 94 40 128 90 "" "" "Read dBase File" <:#202,9360>FONT 6 "HELV" <:#202,9360>6 28 64 56 9001 1352728579 "listbox" "" 0 <:#202,9360>6 16 40 10 1000 1342308352 "static" "dBase files:" 0 <:#202,9360>8 4 60 10 7999 1342177280 "static" "" 0 <:#202,9360>82 4 40 14 1 1342373889 "button" "OK" 0 <:#202,9360>82 20 40 14 2 1342373888 "button" "Cancel" 0 <:#202,9360>END DIALOG <:#202,9360> <:#202,9360> <:#202,9360>DIALOG Dbasefun <:#202,9360>-2134376448 13 76 42 162 122 "" "" "dBase File Info" <:#202,9360>FONT 6 "HELV" <:#202,9360>8 6 46 10 1000 1342177280 "static" "dBase file:" 0 <:#202,9360>60 6 50 10 1001 1342177280 "static" " " 0 <:#202,9360>8 18 46 10 1002 1342177280 "static" "Last edited:" 0 <:#202,9360>60 18 50 10 1003 1342177280 "static" " " 0 <:#202,9360>8 30 50 10 1004 1342177280 "static" "Total records:" 0 <:#202,9360>60 30 50 10 1005 1342177280 "static" " " 0 <:#202,9360>60 42 50 10 1006 1342177280 "static" "" 0 <:#202,9360>58 54 96 48 9000 1352663041 "listbox" "" 0 <:#202,9360>8 42 50 10 1007 1342177280 "static" "Num. of fields:" 0 <:#202,9360>8 54 48 10 1008 1342177280 "static" "Field names:" 0 <:#202,9360>6 104 80 14 3 1342373888 "button" "Create Description File" 0 <:#202,9360>114 4 40 14 1 1342373889 "button" "OK" 0 <:#202,9360>114 20 40 14 2 1342373888 "button" "Cancel" 0 <:#202,9360>END DIALOG > [Embedded] 00005512 > [macsum] 3 Multiple 0 0 33 2 Import 1718 0 -1 70 Dbasefun 2032 0 -1 81 [macse] 14 Multiple 5 40 21 1 [X] 0 268 13 8 2 0 31 9001 "{2}*.dbf" 0 26 "." "import" 13 8 3 6 3 5 1 18 1 11 00000136 6 0 15 9 0 27 9001 13 8 4 0 296 1 0 789 "Please Wait...Reading dBase file info ......" 0 290 13 8 5 0 259 "{5}{4}" "r" 13 8 6 5 1 8 7 5 32 6 7 18 2 12 00000350 10 00000428 5 1 6 7 3 0 8 7 10 00000274 0 782 "{6}" 1 13 8 8 0 40 "{8}" 13 8 9 6 7 7 "{9}" 23 1 10 00000317 5 4 22 1 8 10 5 3 22 1 8 11 5 2 22 1 8 12 5 5 22 1 5 256 5 6 22 1 4 0 3 0 8 13 5 9 22 1 5 256 5 10 22 1 4 0 3 0 8 14 5 11 22 1 5 256 5 12 22 1 4 0 3 0 8 15 6 14 5 32 3 1 5 32 4 1 8 16 0 19 "" "" 0 "{16}" 13 8 16 6 16 21 17 [X] 6 16 21 18 [X] 0 31 1001 "{4}" 0 31 1003 "{11}/{10}/{12}" 0 31 1005 "{13}" 0 31 1006 "{16} Fields" 5 1 8 19 6 16 6 19 18 2 12 00000894 10 00001218 5 1 6 19 3 0 8 19 10 00000815 6 19 0 782 "{6}" 11 13 23 17 0 782 "{6}" 1 13 8 20 0 782 "{6}" 4 13 8 21 0 782 "{6}" 1 13 0 40 [X] 13 8 22 0 782 "{6}" 1 13 0 40 [X] 13 8 23 0 782 "{6}" 13 13 8 24 0 782 "{6}" 1 13 8 25 6 19 22 17 0 31 9000 [X] 6 19 7 "{26}^{20}^{22}" 23 18 6 19 22 17 8 27 6 19 22 18 8 28 10 00000859 0 296 0 0 260 "{6}" 0 789 "" 0 26 "." "Dbasefun" 13 8 3 6 3 5 3 18 0 11 00001492 2 101 1 "~default.sty" 0 0 0 6 "dBase[13]" 5 1 8 29 6 16 6 29 18 2 12 00001444 10 00001492 5 1 6 29 3 0 8 29 10 00001365 6 29 22 17 8 27 0 6 "{27}[13]" 10 00001409 7 "Here is a dBase description file. To use this in a merge, " 8 30 7 "save the untitled as a file. For additional help, see the Ami " 8 31 7 "Pro chapter on Merging Text and Data." 8 32 0 3 "{30}{31}{32}" 6 0 15 9 DIALOG Import -2134376448 5 94 40 128 90 "" "" "Read dBase File" FONT 6 "HELV" 6 28 64 56 9001 1352728579 "listbox" "" 0 6 16 40 10 1000 1342308352 "static" "dBase files:" 0 8 4 60 10 7999 1342177280 "static" "" 0 82 4 40 14 1 1342373889 "button" "OK" 0 82 20 40 14 2 1342373888 "button" "Cancel" 0 DIALOG Dbasefun -2134376448 13 76 42 162 122 "" "" "dBase File Info" FONT 6 "HELV" 8 6 46 10 1000 1342177280 "static" "dBase file:" 0 60 6 50 10 1001 1342177280 "static" " " 0 8 18 46 10 1002 1342177280 "static" "Last edited:" 0 60 18 50 10 1003 1342177280 "static" " " 0 8 30 50 10 1004 1342177280 "static" "Total records:" 0 60 30 50 10 1005 1342177280 "static" " " 0 60 42 50 10 1006 1342177280 "static" "" 0 58 54 96 48 9000 1352663041 "listbox" "" 0 8 42 50 10 1007 1342177280 "static" "Num. of fields:" 0 8 54 48 10 1008 1342177280 "static" "Field names:" 0 6 104 80 14 3 1342373888 "button" "Create Description File" 0 114 4 40 14 1 1342373889 "button" "OK" 0 114 20 40 14 2 1342373888 "button" "Cancel" 0 00005537