Description of SmartwareII .DB files. ------------------------------------- BYTES DESCRIPTION ------------- ------------------------------------------------------ 2064 - 2067 Number Of Records. X1+(256*X2)+(256^2*X3)+(256^3*X4). 2080 - 2081 Number Of fields. X1+(256*X2). For i = 1 to Number Of Fields. (Starting at 2104) 2 Bytes Field Length. X1+(256*X2). 2 Bytes Field Offset X1+(256*X2). 1 Bytes Field Type 1=Inverted 2=Alpha 3=Numeric 4=Counter 5=Date 6=Time 1 Bytes Key Field 0=Non-KeyField. 1=KeyField. 22 Bytes Field Name X1+(256*X2). End For (2104+ (98*NumOfFields)) Start reading data. ---------------------------------------------------------------------------- Global FieldNames[100] Global FieldTypes[100] Global FieldLengths[100] Global DbFields() Global FileName FileName = Upper(Ask("Enter FileName:")) quiet off DbFields() Function DbFields() Local NumOfFields Ctr Local BinHeader BinNumOfFields BinDummy Local BinFieldLength BinFieldOffset BinFieldType BinFieldName Local FieldLength FieldOffset FieldType FieldName Local mydata BinData locat Local BinRecNum Local Recs[4] Local TotalRecs BUFFER BinRecNum SIZE 1 BUFFER BinHeader SIZE 2080 BUFFER BinNumOfFields SIZE 2 BUFFER BinDummy SIZE 22 BUFFER BinData SIZE 22 BUFFER BinFieldLength SIZE 2 BUFFER BinFieldOffset Size 2 BUFFER BinFieldType Size 2 BUFFER BinFieldName Size 22 clear recs[] Fopen FileName as 1 Fseek 1 2064 For Ctr = 1 to 4 Fread 1 Binary 1 Into BinRecNum UnPack BinRecNum "B" Recs[Ctr] End For TotalRecs = Recs[1] + (256*Recs[2]) + (256^2*Recs[3]) + (256^3*Recs[4]) Fseek 1 2080 Fread 1 Binary 2 Into BinNumOfFields UnPack BinNumOfFields "B" NumOfFields Fread 1 Binary 22 Into BinDummy For Ctr = 1 to NumOfFields Fread 1 Binary 2 Into BinFieldLength UnPack BinFieldLength "B" FieldLengths[Ctr] Fread 1 Binary 2 Into BinFieldOffset UnPack BinFieldLength "B" FieldOffset Fread 1 Binary 2 Into BinFieldType UnPack BinFieldType "B" FieldTypes[Ctr] Fread 1 Binary 22 Into BinFieldName UnPack BinFieldName "S" FieldNames[Ctr] ' All = All & fieldname End For locat = (2104+(98*NumOfFields)) Fseek 1 locat+4+NumOfFields For Ctr = 1 to TotalRecs Fread 1 Binary FieldLengths[1] Into BinData UnPack BinData "S" MyData message mydata Fread 1 Binary FieldLengths[2] Into BinData UnPack BinData "B" MyData Fread 1 Binary 6 Into BinData ' message FieldLengths[Ctr] End For fclose 1 End Function