Listing: 1 IMPLEMENTATION MODULE DBFGas; 2 (* 3 * ModBase 4 * Release 3.0 5 * (c) Copyright 1986 - 1991 PMI 6 * P.O. Box 8402 7 * Green Bay Wi 53308 8 * All Rights Reserved 9 * by Ed Ross 10 *) 11 12 FROM ModBase3 IMPORT InitDBF,OpenDBF,CloseDBF,ReadDBRec,GetField,DBFile, 13 DefaultFixUp,NilDBF; 14 FROM DBCopier IMPORT DBPack; 15 FROM DBIndxes IMPORT InitIndex,OpenIndex,AddToUpdateList,CloseIndex, 16 CurrentRec,FindPositionCh,BuildIndex,GoTop,GoBottom, 17 NextRecord,PrevRecord,CurrentKeyCh,FindPositionN, 18 CurrentKeyN,InitCompIndex,BuildCompIndex,DBIndex; 19 FROM Drectory IMPORT DeleteFile; 20 FROM StrEdit IMPORT CrunchBlanks,Append; 21 FROM StrConv IMPORT StrToReal; 22 FROM NumTypes IMPORT Real8,REALToReal8; 23 FROM DBStuff IMPORT MakeKey; 24 FROM ScanUtils IMPORT Present,CaseSens; 25 FROM DBFields IMPORT GetDateField,GetLogicalField,GetNumField,Replace, 26 ReplaceD,ReplaceN; 27 28 29 30 CONST 31 Buffer = 0; 32 Safty = TRUE; 33 Exclusive = FALSE; 34 AutoLock = TRUE; 35 36 VAR DBInit,IndexOpen : BOOLEAN; 37 38 PROCEDURE MoveGasToDBF(Rec : GasRec ); ***** ^ undeclared identifier 39 (* This code will move the data from the record to *) 40 (* the data base *) 41 BEGIN 42 WITH Rec DO ***** ^ not supported yet 43 Replace( GasDBF, 1,CIN); (* customer id number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 44 Replace( GasDBF, 2,INVNBR ); (* Out - Invoice number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 45 Replace( GasDBF, 3,ITEMNBR ); (* Helium type *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 46 ReplaceD( GasDBF, 4,DATEOUT ); (* Helium out date *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 47 ReplaceD( GasDBF, 5,DUEDATE ); (* Helium due date *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 48 ReplaceD( GasDBF, 6,DATEIN ); (* Helium date in *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 49 Replace( GasDBF, 7,STATUS ); (* Sequence number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 50 ReplaceN( GasDBF, 8,OVCHGAMT ); (* over time charge amount *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 51 ReplaceN( GasDBF, 9,REALToReal8(FLOAT(DAYSLATE ))); (* Sequence number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 52 Replace( GasDBF, 10,ININVNBR ); (* Check in invoice nubmer *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 53 END; (* end of with REC *) ***** ^ not supported yet 54 END MoveGasToDBF; ***** ^ not supported yet 55 56 57 58 PROCEDURE MoveGasFromDBF(VAR Rec : GasRec ); ***** ^ undeclared identifier 59 (* This code will move the data from the Database to *) 60 (* the record *) 61 VAR B : BOOLEAN; 62 R : Real8; 63 BEGIN 64 WITH Rec DO ***** ^ not supported yet 65 GetField( GasDBF, 1,CIN ); (* customer id number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 66 GetField( GasDBF, 2,INVNBR ); (* Out - Invoice number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 67 GetField( GasDBF, 3,ITEMNBR ); (* Helium type *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 68 GetDateField( GasDBF, 4,DATEOUT ); (* Helium out date *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 69 GetDateField( GasDBF, 5,DUEDATE ); (* Helium due date *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 70 GetDateField( GasDBF, 6,DATEIN ); (* Helium date in *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 71 GetField( GasDBF, 7,STATUS ); (* Sequence number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 72 GetNumField( GasDBF, 8,OVCHGAMT ); (* over time charge amount *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 73 GetNumField( GasDBF, 9,R); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 74 DAYSLATE := TRUNC(R); (* Sequence number *) ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 75 GetField( GasDBF, 10,ININVNBR ); (* Check in invoice nubmer *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 76 END; (* end of with REC^ *) ***** ^ not supported yet 77 END MoveGasFromDBF; ***** ^ not supported yet 78 79 PROCEDURE MakeGasOutKey(DBF : DBFile; Idx : DBIndex; 80 VAR Key : ARRAY OF CHAR); ***** ^ not supported yet 81 VAR 82 BEGIN 83 GetField(GasDBF,2,Key); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 84 MakeKey(Key); ***** ^ not supported yet ***** ^ not supported yet 85 END MakeGasOutKey; ***** ^ not supported yet 86 87 88 PROCEDURE MakeGasInKey(DBF : DBFile; Idx : DBIndex; 89 VAR Key : ARRAY OF CHAR); ***** ^ not supported yet 90 VAR 91 BEGIN 92 GetField(GasDBF,10,Key); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 93 MakeKey(Key); ***** ^ not supported yet ***** ^ not supported yet 94 END MakeGasInKey; ***** ^ not supported yet 95 96 97 PROCEDURE MakeGasKey( DBF : DBFile; Idx : DBIndex; 98 VAR Key : ARRAY OF CHAR); ***** ^ not supported yet 99 VAR 100 B : BOOLEAN; 101 Str : ARRAY[0..15] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 102 BEGIN 103 GetField( GasDBF, 1,Key ); (* customer id number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 104 GetField( GasDBF, 7,Str ); (* Sequence number *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 105 Append(Key,Str); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 106 GetField( GasDBF, 3,Str ); (* Helium type *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 107 Append(Key,Str); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 108 MakeKey(Key); ***** ^ not supported yet ***** ^ not supported yet 109 END MakeGasKey; ***** ^ not supported yet 110 111 112 113 114 PROCEDURE OpenGasDBF(WithIdx : BOOLEAN); 115 VAR 116 ER : CARDINAL; 117 BEGIN 118 IndexOpen := WithIdx; 119 120 (* Open the DBF file *) 121 IF NOT DBInit THEN 122 DBInit:=TRUE; 123 InitDBF("Gas.DBF", GasDBF,Buffer,Safty,Exclusive,AutoLock,DefaultFixUp ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 124 InitCompIndex( "Gas.Idx",GasIdx,GasDBF,MakeGasKey,Buffer, ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 125 Safty,FALSE,Exclusive); ***** ^ not supported yet ***** ^ not supported yet 126 AddToUpdateList( GasDBF, GasIdx ); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 127 128 InitCompIndex( "GasOut.Idx",GasOutIdx,GasDBF,MakeGasOutKey,Buffer, ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 129 Safty,FALSE,Exclusive); ***** ^ not supported yet ***** ^ not supported yet 130 AddToUpdateList( GasDBF, GasOutIdx ); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 131 132 InitCompIndex( "GasIn.Idx",GasInIdx,GasDBF,MakeGasInKey,Buffer, ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier ***** ^ not supported yet 133 Safty,FALSE,Exclusive); ***** ^ not supported yet ***** ^ not supported yet 134 AddToUpdateList( GasDBF, GasInIdx ); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ undeclared identifier 135 END; 136 IF NOT OpenDBF( GasDBF) ***** ^ not supported yet ***** ^ undeclared identifier 137 THEN END; 138 139 IF WithIdx 140 THEN 141 142 (* open all indexes and append to dbfile *) 143 IF NOT OpenIndex( GasIdx ) ***** ^ not supported yet ***** ^ undeclared identifier 144 THEN 145 ER := BuildCompIndex(GasIdx,'C','Cin',20); (* check key lenght *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 146 END; 147 IF NOT OpenIndex( GasOutIdx ) ***** ^ not supported yet ***** ^ undeclared identifier 148 THEN 149 ER := BuildCompIndex(GasOutIdx,'C','Cin',20); (* check key lenght *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 150 END; 151 IF NOT OpenIndex( GasInIdx ) ***** ^ not supported yet ***** ^ undeclared identifier 152 THEN 153 ER := BuildCompIndex(GasInIdx,'C','Cin',20); (* check key lenght *) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 154 END; 155 END; 156 END OpenGasDBF; ***** ^ not supported yet 157 158 159 160 PROCEDURE CloseGasDBF (); (* close Data and index files *) 161 162 BEGIN 163 CloseDBF(GasDBF); (* close dbf file *) ***** ^ not supported yet ***** ^ undeclared identifier 164 IF IndexOpen 165 THEN 166 CloseIndex(GasIdx ); (* close index file *) ***** ^ not supported yet ***** ^ undeclared identifier 167 END; 168 END CloseGasDBF; ***** ^ not supported yet 169 170 171 172 PROCEDURE FindGasByCin( Key : ARRAY OF CHAR) : BOOLEAN; ***** ^ not supported yet 173 VAR Found : BOOLEAN; 174 CKey : ARRAY[0..80] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 175 BEGIN 176 FindPositionCh( GasIdx, Key, Found); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 177 CurrentKeyCh(GasIdx,CKey); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 178 Found := Present(Key,CKey,CaseSens); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 179 IF Found 180 THEN ReadDBRec( GasDBF, CurrentRec( GasIdx)); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier 181 END; 182 RETURN Found; 183 END FindGasByCin; ***** ^ not supported yet 184 185 186 187 188 189 190 191 PROCEDURE NextGas () : BOOLEAN; 192 VAR 193 L : LONGINT; (* record number *) 194 BEGIN 195 IF NextRecord( GasIdx,L) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 196 THEN ReadDBRec( GasDBF,L ); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 197 RETURN TRUE; 198 ELSE RETURN FALSE; 199 END; 200 END NextGas; ***** ^ not supported yet 201 202 PROCEDURE PrevGas () : BOOLEAN; 203 VAR 204 L : LONGINT; (* record number *) 205 BEGIN 206 IF PrevRecord( GasIdx,L) ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 207 THEN ReadDBRec( GasDBF,L ); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 208 RETURN TRUE; 209 ELSE RETURN FALSE; 210 END; 211 END PrevGas; ***** ^ not supported yet 212 213 PROCEDURE FirstGas (); 214 VAR 215 L : LONGINT; (* record number *) 216 BEGIN 217 GoTop(GasIdx); ***** ^ not supported yet ***** ^ undeclared identifier 218 ReadDBRec( GasDBF,CurrentRec( GasIdx)); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier 219 END FirstGas; ***** ^ not supported yet 220 221 PROCEDURE LastGas (); 222 VAR 223 L : LONGINT; (* record number *) 224 BEGIN 225 GoBottom(GasIdx); ***** ^ not supported yet ***** ^ undeclared identifier 226 ReadDBRec( GasDBF,CurrentRec( GasIdx)); ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier 227 END LastGas; ***** ^ not supported yet 228 229 PROCEDURE PackGas(); 230 VAR 231 EM : CARDINAL; 232 BEGIN 233 CloseGasDBF(); ***** ^ not supported yet ***** ^ not supported yet 234 OpenGasDBF(FALSE); ***** ^ not supported yet ***** ^ not supported yet 235 DBPack(GasDBF); ***** ^ not supported yet ***** ^ undeclared identifier 236 237 CloseDBF(GasDBF); ***** ^ not supported yet ***** ^ undeclared identifier 238 EM := DeleteFile('Gas.IDX'); ***** ^ not supported yet ***** ^ not supported yet 239 OpenGasDBF(TRUE); (* open & rebuild the index *) ***** ^ not supported yet ***** ^ not supported yet 240 CloseGasDBF(); ***** ^ not supported yet ***** ^ not supported yet 241 242 END PackGas; ***** ^ not supported yet 243 244 BEGIN 245 NilDBF(GasDBF); ***** ^ not supported yet ***** ^ undeclared identifier 246 IndexOpen := FALSE; 247 DBInit:=FALSE; 248 249 END DBFGas. ***** ^ not supported yet 236 errors