Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading Turbo Pascal/DOS "file of record" File (Reloaded)

56 views
Skip to first unread message

José Romero

unread,
Dec 27, 2007, 8:53:32 PM12/27/07
to
Hi, previously in
http://groups.google.com/group/borland.public.delphi.language.delphi.win32/browse_thread/thread/1d75e0902f8e1ec3/bcaa2683293c5cff?lnk=st&q=aprod.dat#bcaa2683293c5cff
threat I successfully could read and write such file mentioned there
and many others.

But, I'm having problems with just one file.

One of the record definition of "reg" is:


reg = packed Record
Codigo: String[KM];
Descripcion: String[KN];
Clase: String[KO];
Tipo: Char;
Estadistics: Array[1..NMes,1..EstM] Of Real48;
Case Byte Of
0: ( DummyT: SmallInt;
CNP,CTU,
CTV,CTC,
AVU,TDT,
TDM: Char;
Dummy1: Array[1..10] Of Byte;
PorcentPVP,
PorcentCOB: ArrayComision;
PorcentajeU,
PorcentajeC,
PorcentajeV: ArrayTable;
PorcentSPVP,
PorcentSCOB: ArrayComision;
PorcentajeDT: ArrayTable);
1: ( SPorcentS, { Dummy3 }
MontoS: Real48;
SPorcentPVP: ArrayComision;
SNP: Char);
2: ( Descripcion2: Array[1..2] Of String[40];
Unidad: String[10];
IVAP,
CostoB,
CostoPor,
PrecioV: Real48;
UsaServidor: Boolean;
FechaUV: String[8];
PrecioO: Array[1..2] Of Real48;
Exento: Boolean;
TDummy: Real48;
SComis: String[15];
{Cambios del dia 12-9-98 OJO !!!}
FlagContab1: Boolean;
CuentaContab1,
CuentaContab2: String[25]);
3: ( PorcentajeT: Real48;
PImpuesto: ArrayTable;
Diferimiento: SmallInt;
BasePorct: Real48 );
4: ( NroClts: Word; );
5: ( NPr: SmallInt;
Compuesto,
Seriales: Boolean;
Comi: Char;
PorcentPVPD,
PorcentCOBD: ArrayComision;
{Cambios del dia 12-9-98 OJO !!!}
FlagContab2: Boolean;
CtasContable: Array[1..6] Of String[25];
IsTalla,
IsColor: Boolean);
6: ( TipoOp1: Char;
DptoInicial: String[KM]);
End;


and the other version of same record is:

reg = packed Record
Codigo: String[KM];
Descripcion: String[KN];
Clase: String[KO];
Tipo: Char;
Estadistics: Array[1..NMes,1..EstM] Of Real48;
Case Byte Of
0: ( DummyT: Integer;
CNP,CTU,
CTV,CTC,
AVU,TDT,
TDM: Char;
Dummy1: Array[1..10] Of Byte;
PorcentPVP,
PorcentCOB: ArrayComision;
PorcentajeU,
PorcentajeC,
PorcentajeV: ArrayTable;
PorcentSPVP,
PorcentSCOB: ArrayComision;
PorcentajeDT: ArrayTable);
1: ( SPorcentS, { Dummy3 }
MontoS: Real48;
SPorcentPVP: ArrayComision;
SNP: Char);
2: ( Descripcion2: Array[1..2] Of String[40];
Unidad: String[10];
IVAP,
CostoB,
CostoPor,
PrecioV: Real48;
UsaServidor: Boolean;
FechaUV: String[8];
PrecioO: Array[1..2] Of Real;
Exento: Boolean;
TDummy: Real48;
SComis: String[15];
{Cambios del dia 12-9-98 OJO !!!}
FlagContab1: Boolean;
CuentaContab1,
CuentaContab2: String[25]);
3: ( PorcentajeT: Real48;
PImpuesto: ArrayTable;
Diferimiento: Integer;
BasePorct: Real48 );
4: ( NroClts: Word; );
5: ( NPr: SmallInt;
Compuesto,
Seriales: Boolean;
Comi: Char;
PorcentPVPD,
PorcentCOBD: ArrayComision;
{Cambios del dia 12-9-98 OJO !!!}
FlagContab2: Boolean;
CtasContable: Array[1..6] Of String[25]);
6: ( TipoOp: Char );
End;

Reg2 = packed record
Case Byte Of
0: (Conf: RegConfArchivo);
1: (MData: Reg);
End;


Reg3 = packed record
Status: LongInt;
Spl: Reg2;
DataArea: Array[1..1] Of Byte;
End;

as seen, all Integer was changed to SmallInt. Real to Real48, and all
record has been declared as packed.

But, reading the file using the same methods used in the others files
are not working. Using it like they are declared just garbage and white
spaces are readed.

Chaging "Dummy1:Array[1..10] Of Byte" to "Dummy1: Array[1..110] Of
Byte" (because in this record are 2 field of string[40] and 1
string[30]) I can read the the type of RegConfArchivo, but with empty
records at the begining. Later all is garbagge and spaces.

I've attached to the attachments group a rar file with a test project
and the file created with the dos program. I'm almost sure that is
something to do with the record declaration. Some missing fields or so.


Thanx in advance


José Romero
isla de Margarita, Venezuela

Rudy Velthuis [TeamB]

unread,
Dec 28, 2007, 1:06:35 PM12/28/07
to
José Romero wrote:

> Chaging "Dummy1:Array[1..10] Of Byte" to "Dummy1: Array[1..110] Of
> Byte" (because in this record are 2 field of string[40] and 1
> string[30]) I can read the the type of RegConfArchivo, but with
> empty records at the begining. Later all is garbagge and spaces.
>
> I've attached to the attachments group a rar file with a test project
> and the file created with the dos program. I'm almost sure that is
> something to do with the record declaration. Some missing fields or
> so.

The

array[1..1] of Byte;

definition seems to hint at a variable end of the record, i.e. that
some data will follow. I have no idea how big this data is, but I guess
one of the many many values in the deeply nested records will contain
the size of the following data.

Do you still have the source for the DOS program? I'm sure that would
be a big help understanding what is actually going on.

--
Rudy Velthuis [TeamB] http://www.teamb.com

"Computer dating is fine, if you're a computer."
-- Rita May Brown.

Loren Pechtel

unread,
Dec 28, 2007, 1:11:39 PM12/28/07
to
On Thu, 27 Dec 2007 21:53:32 -0400, José Romero <siste...@cantv.net>
wrote:

> Estadistics: Array[1..NMes,1..EstM] Of Real48;

...


>as seen, all Integer was changed to SmallInt. Real to Real48, and all
>record has been declared as packed.

But the arrays are *NOT*. Pack your arrays.

>But, reading the file using the same methods used in the others files
>are not working. Using it like they are declared just garbage and white
>spaces are readed.

I note that the records start with 3 string fields. Look for where
those strings actually end up and you'll have a good idea of how far
off your record size is and this will generally make it much easier to
figure out what your mistake is.

Rudy Velthuis [TeamB]

unread,
Dec 28, 2007, 1:24:24 PM12/28/07
to
Loren Pechtel wrote:

> On Thu, 27 Dec 2007 21:53:32 -0400, José Romero <siste...@cantv.net>
> wrote:
>
> > Estadistics: Array[1..NMes,1..EstM] Of
> > Real48;
> ...
> > as seen, all Integer was changed to SmallInt. Real to Real48, and
> > all record has been declared as packed.
>

> But the arrays are NOT. Pack your arrays.

AFAIK, arrays are and were always packed, in Delphi and Turbo Pascal.

--
Rudy Velthuis [TeamB] http://www.teamb.com

"He is one of those people who would be enormously improved by
death." -- H. H. Munro (Saki) (1870-1916)

José Romero

unread,
Dec 28, 2007, 1:13:54 PM12/28/07
to
Rudy Velthuis [TeamB] wrote:
> Loren Pechtel wrote:
>
>> On Thu, 27 Dec 2007 21:53:32 -0400, José Romero <siste...@cantv.net>
>> wrote:
>>
>>> Estadistics: Array[1..NMes,1..EstM] Of
>>> Real48;
>> ...
>>> as seen, all Integer was changed to SmallInt. Real to Real48, and
>>> all record has been declared as packed.
>> But the arrays are NOT. Pack your arrays.
>
> AFAIK, arrays are and were always packed, in Delphi and Turbo Pascal.
>

Hi,

The problem is just with this record. I've been able to read another
records from others files (declared in the same file attached) with
arrays of real48 and Byte with no problems. The problems seems to be in
the field Dummy1 in the first record case, I think.

I don't have the original file which read or writes to the file. The old
system just came with this type definition file and a small sample of
reading a file with other record structure which I've already read and
write to it after changing real, integers an packed records. Is an old
POS/CRM/ERP DOS system made here in my country and widely used. I'm
working in an import data utility for a new system I'm developing. I
just too much data for manual processing.

Mike Williams (TeamB)

unread,
Dec 28, 2007, 3:15:59 PM12/28/07
to
José Romero wrote:

> But, I'm having problems with just one file.

Use the SizeOf() function to determine the exact size in bytes of each
record definition. The two examples you've provided here equate to
1121 and 1123 bytes. The sample file you provided in the attachments
group has a record size of 1283 bytes, a difference of 150 or 152.
That's a far bigger difference than I'd expect from the data type
differences. As I recall records were packed by default in Turbo
Pascal and Delphi 1.0 and it wasn't until the first 32-bit version that
an unpacked record would have been more efficient in memory. It's more
likely that one of the array constant sizes has changed.

Normally I'd be able to compare the record definition to the actual
file content visually but my Spanish is insufficient in this case.

--
-Mike (TeamB)

José Romero

unread,
Dec 28, 2007, 2:57:49 PM12/28/07
to
I can translate for you. What do you need to be translated? The contents
of file or the record structure?

Thanxs

Mike Williams (TeamB)

unread,
Dec 28, 2007, 3:59:50 PM12/28/07
to
José Romero wrote:

> I can translate for you. What do you need to be translated? The
> contents of file or the record structure?

It's more an issue of looking at the file and wondering if "TRADUCCION"
is a valid "Clase" or "2" makes sense in the "Tipo" field. Now that
I've looked at it some more it seems that the file is mostly null bytes
and there are only a few string fields to visually identify.

One option that I've used in the past is to use the original program to
change a specific field in the record and compare the file before and
after to see where that field was stored. If you repeat that process
enough you can more accurately determine the structure. As I said
before you need to define a record type that has 1283 bytes if you want
to be able to read the file as a file of records. Otherwise successive
records won't be aligned properly and the file itself would likely end
with a partial record.

--
-Mike (TeamB)

José Romero

unread,
Dec 28, 2007, 3:55:32 PM12/28/07
to
ok, here we go

All these records are the definition of the RegConfArchivo, that is, the
caption, the data type, the length, etc of records. Is used for display
in CRUD forms in the DOS program

C¢digo A

Descripci¢n A(( Clase A

Direcci¢n A(( Direcci¢n A(( *
Tel‚fonos A ( S
Nivel precios A Tabla de VentasA Tabla de
CobrosA Tabla de UtilidA D¡as
toleranciaA












q C¢digo
A

Descripci¢n A(( Clase A

Direcci¢n A(( Direcci¢n A(( *
Tel‚fonos A ( S Nivel de precioA
Monto por serviN














C¢digo A


Descripci¢n 1 A((
Descripci¢n 2 A((
Descripci¢n 3 A(( Clase A

Unidad A

Costo N
% de Costo N Precio de ventaN Precio 2
N
Precio 3 N
Usa servidor A I.S.V. N
Comisi¢n servidN











C¢digo
A

Descripci¢n A(( Clase A


% Retenci¢n N I.S.L.R. N D¡as
diferimienN















C¢digo A

Descripci¢n A(( Clase A


















C¢digo A

Descripci¢n A(( Clase A

Compuesto A Seriales A
Comisiones A














)
C¢digo A

Descripci¢n A(( Clase A


Responsable A((
















C¢digo A

Descripci¢n A(( Clase A


........
The 'Tipo : Char' Field in record is used to determine the kind of record

_DigVend = '0'; // case 0
_DigMeca = '1'; // case 1
_DigServ = '2'; // case 2
_DigTarj = '3'; // case 3
_DigZona = '4'; // case 4
_DigDepa = '5'; // case 5
_DigDepo = '6'; // case 6
_DigOper = '7'; // case 7

01 DIRECTO GRATEROL PEREZ 0—
is of Kind '0'


01 EQUIPOS COMPUTACION 6 i
is Kind '6'

02 AMERICAN EXPRESL AMERICAN 3
is Kind '3'

00003 SERVICIO SCANEO IMAGEN O IMPRESION SCANEO 2‚
is Kind '2'

17 Material para Rotulacion 5
is Kind '5'

this is a hex view of a record added of kid '2', all the string fields
were filled with x and the numeric with 9999999999.


000159BA
0A 58 .X
000159D5 58 58 58 58 58 58 58 58 58 28 78 78 78 78 78 78 78 78 78 78
78 78 78 78 78 78 78 XXXXXXXXX(xxxxxxxxxxxxxxxxx
000159F0 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78
78 78 78 0A 78 78 78 xxxxxxxxxxxxxxxxxxxxxxx.xxx
00015A0B 78 78 78 78 78 78 78 32 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 xxxxxxx2...................
00015A26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015A41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015A5C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015A77 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015A92 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015AAD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015AC8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015AE3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015AFE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015B19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015B34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015B4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015B6A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015B85 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015BA0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015BBB 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015BD6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015BF1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015C0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015C27 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015C42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015C5D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015C78 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015C93 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015CAE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015CC9 00 00 00 00 00 00 00 00 28 78 78 78 78 78 78 78 78 78 78 78
78 78 78 78 78 78 78 ........(xxxxxxxxxxxxxxxxxx
00015CE4 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78
78 78 28 78 78 78 78 xxxxxxxxxxxxxxxxxxxxxx(xxxx
00015CFF 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78
78 78 78 78 78 78 78 xxxxxxxxxxxxxxxxxxxxxxxxxxx
00015D1A 78 78 78 78 78 78 78 78 78 0A 78 78 78 78 78 78 78 78 78 78
00 00 00 00 00 00 A2 xxxxxxxxx.xxxxxxxxxx......¢
00015D35 C0 FF F8 02 15 00 00 00 00 00 00 A2 C0 FF F8 02 15 00 00 00
00 00 00 00 00 00 00 Àÿø........¢Àÿø............
00015D50 A2 C0 FF F8 02 15 A2 C0 FF F8 02 15 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ¢Àÿø..¢Àÿø.................
00015D6B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015D86 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015DA1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015DBC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015DD7 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015DF2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015E0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015E28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015E43 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015E5E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015E79 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015E94 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015EAF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 ...........................
00015ECA 00 00 00 00 00 00 00 00
........

data: array[0..1278] of byte = (
$0A, $58, $58, $58, $58, $58, $58, $58, $58, $58, $58, $28, $78, $78,
$78, $78,
$78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $78,
$78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $78,
$78, $78, $78, $78, $0A, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $32,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$28, $78,
$78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $78,
$78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $78,
$78, $78, $78, $78, $78, $78, $78, $28, $78, $78, $78, $78, $78, $78,
$78, $78,
$78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $78,
$78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78,
$78, $78,
$0A, $78, $78, $78, $78, $78, $78, $78, $78, $78, $78, $00, $00, $00,
$00, $00,
$00, $A2, $C0, $FF, $F8, $02, $15, $00, $00, $00, $00, $00, $00, $A2,
$C0, $FF,
$F8, $02, $15, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $A2,
$C0, $FF,
$F8, $02, $15, $A2, $C0, $FF, $F8, $02, $15, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00,
$00, $00,
$00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
);


I've not experience dealing with this kind of data, in hex or bytes, so
I appreciate so much any help in this

Mike Williams (TeamB)

unread,
Dec 28, 2007, 8:44:05 PM12/28/07
to
José Romero wrote:

> this is a hex view of a record added of kid '2', all the string
> fields were filled with x and the numeric with 9999999999.

Yes; as I already determined the string fields are fairly obvious at
the start of each record. That's the easy part. The rest of the
record is mostly numeric fields so you'll just see a lot of null bytes
anywhere there's an integer or real value of 0 or 0.0. To manually
update the file and then examine the difference you'd need to put a
specific numeric value in each field. I can't see where you added
9999999999 (that's not how it would look examining the file in hex or
binary) but I still see lots of null bytes.

--
-Mike (TeamB)

José Romero

unread,
Dec 28, 2007, 9:26:17 PM12/28/07
to
Hi,

I just reinstall the program with all empty data files. I added a record
of each type and filled some of the arrays with values (ArrayComision
and ArrayTable types). They are comissions sale's ranges. ie, From 100
to 200 10%, etc.

I'm going to post it to the attachments group thread, check it out. And
many, many thanks for dedicating your valuable time to this.

Mike Williams (TeamB)

unread,
Dec 28, 2007, 11:17:04 PM12/28/07
to
José Romero wrote:

> I just reinstall the program with all empty data files. I added a
> record of each type and filled some of the arrays with values
> (ArrayComision and ArrayTable types). They are comissions sale's
> ranges. ie, From 100 to 200 10%, etc.

You're on the right track now. I took your latest sample file and then
made a few changes to your test program to make it work better. It's
tedious work but you've got a very complex record type. The most
important thing is that the record size *must* equal 1283 because
that's the record size of the actual file. The file size is 20528 and
there are 16 records in the file. I first added some extra bytes to
the very end to make it add up to 1283. I then noticed that the
commission numbers didn't line up so I made another adjustment. Here
are my changes to your record types (look for MLW) as well as modified
test code that logs more of the data. You may well need to make
further adjustments but this is much closer.

RegSplMultiple = packed Record


Codigo: String[KM];
Descripcion: String[KN];
Clase: String[KO];
Tipo: Char;
Estadistics: Array[1..NMes,1..EstM] Of Real48;
Case Byte Of
0: ( DummyT: SmallInt;
CNP,CTU,
CTV,CTC,
AVU,TDT,
TDM: Char;

Dummy1: Array[1..10] Of Byte; //
MLW - was 110

---

RegMultiple = packed record
Status: LongInt;
Spl: RegSplMultiple2;


DataArea: Array[1..1] Of Byte;

Padding : array[1..113] of Byte; // MLW - make
record add up to 1283
End;

procedure TForm1.btn1Click(Sender: TObject);
var
i : integer;
begin
System.AssignFile(F, 'amult.dat');
System.Reset(F);
System.Seek(f, 0);
while not System.Eof(F) do begin
System.Read(f, p);
Log('p.Spl.MData.Tipo <'+p.Spl.MData.Tipo+'>');
case p.Spl.MData.Tipo of
// Note that we're not logging all of the variant record sections
and not all of the fields within those sections
'0' : begin
Log('p.Spl.MData.CNP <'+p.Spl.MData.CNP+'>');
Log('p.Spl.MData.CTU <'+p.Spl.MData.CTU+'>');
Log('p.Spl.MData.CTV <'+p.Spl.MData.CTV+'>');
Log('p.Spl.MData.CTC <'+p.Spl.MData.CTC+'>');
Log('p.Spl.MData.AVU <'+p.Spl.MData.AVU+'>');
Log('p.Spl.MData.CTC <'+p.Spl.MData.TDT+'>');
Log('p.Spl.MData.TDM <'+p.Spl.MData.TDM+'>');
for i := 1 to NPVP do begin
Log('p.Spl.MData.PorcentPVP['+IntToStr(i)+']
<'+Format('%0.2f', [p.Spl.MData.PorcentPVP[i]])+'>');
Log('p.Spl.MData.PorcentCOB['+IntToStr(i)+']
<'+Format('%0.2f', [p.Spl.MData.PorcentCOB[i]])+'>');
Log('p.Spl.MData.PorcentSPVP['+IntToStr(i)+']
<'+Format('%0.2f', [p.Spl.MData.PorcentSPVP[i]])+'>');
Log('p.Spl.MData.PorcentSCOB['+IntToStr(i)+']
<'+Format('%0.2f', [p.Spl.MData.PorcentSCOB[i]])+'>');
end;
for i := 1 to NV do begin
Log('p.Spl.MData.PorcentajeU['+IntToStr(i)+'].Mto
<'+Format('%0.2f', [p.Spl.MData.PorcentajeU[i].Mto])+'>');
Log('p.Spl.MData.PorcentajeU['+IntToStr(i)+'].Porct
<'+Format('%0.2f', [p.Spl.MData.PorcentajeU[i].Porct])+'>');
Log('p.Spl.MData.PorcentajeC['+IntToStr(i)+'].Mto
<'+Format('%0.2f', [p.Spl.MData.PorcentajeC[i].Mto])+'>');
Log('p.Spl.MData.PorcentajeC['+IntToStr(i)+'].Porct
<'+Format('%0.2f', [p.Spl.MData.PorcentajeC[i].Porct])+'>');
Log('p.Spl.MData.PorcentajeV['+IntToStr(i)+'].Mto
<'+Format('%0.2f', [p.Spl.MData.PorcentajeV[i].Mto])+'>');
Log('p.Spl.MData.PorcentajeV['+IntToStr(i)+'].Porct
<'+Format('%0.2f', [p.Spl.MData.PorcentajeV[i].Porct])+'>');
end;
end;
'2' : begin
Log('p.Spl.MData.Descripcion
<'+p.Spl.MData.Descripcion+'>');
Log('p.Spl.MData.Unidad <'+p.Spl.MData.Unidad+'>');
Log('p.Spl.MData.IVAP
<'+Format('%0.2f',[p.Spl.MData.IVAP])+'>');
Log('p.Spl.MData.CostoB
<'+Format('%0.2f',[p.Spl.MData.CostoB])+'>');
Log('p.Spl.MData.CostoPor
<'+Format('%0.2f',[p.Spl.MData.CostoPor])+'>');
Log('p.Spl.MData.PrecioV
<'+Format('%0.2f',[p.Spl.MData.PrecioV])+'>');
Log('p.Spl.MData.FechaUV <'+p.Spl.MData.FechaUV+'>');
Log('p.Spl.MData.SComis <'+p.Spl.MData.SComis+'>');
Log('p.Spl.MData.CuentaContab1
<'+p.Spl.MData.CuentaContab1+'>');
Log('p.Spl.MData.CuentaContab2
<'+p.Spl.MData.CuentaContab2+'>');
end;
'6' : begin
Log('');
Log('p.Spl.MData.TipoOp1 <'+p.Spl.MData.TipoOp1+'>');
Log('p.Spl.MData.DptoInicial
<'+p.Spl.MData.DptoInicial+'>');
end;
end;
end;
System.CloseFile(f);
end;

--
-Mike (TeamB)

José Romero

unread,
Dec 28, 2007, 11:12:23 PM12/28/07
to
Mike Williams (TeamB) wrote:
> José Romero wrote:
>
>> I just reinstall the program with all empty data files. I added a
>> record of each type and filled some of the arrays with values
>> (ArrayComision and ArrayTable types). They are comissions sale's
>> ranges. ie, From 100 to 200 10%, etc.
>
> You're on the right track now. I took your latest sample file and then
> made a few changes to your test program to make it work better. It's
> tedious work but you've got a very complex record type. The most
> important thing is that the record size *must* equal 1283 because
> that's the record size of the actual file. The file size is 20528 and
> there are 16 records in the file. I first added some extra bytes to
> the very end to make it add up to 1283. I then noticed that the
> commission numbers didn't line up so I made another adjustment. Here
> are my changes to your record types (look for MLW) as well as modified
> test code that logs more of the data. You may well need to make
> further adjustments but this is much closer.
>

WOW !!! works perfect !!! nothing to change at all, nothing.

You don't know how much I thank you by this, really. Is a pleasure to
know that you and the other teamb members are around here. Thanx a lot

José Romero
Isla de Margarita, Venezuela

0 new messages