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

StBCD Error

7 views
Skip to first unread message

Carl Scorup

unread,
Nov 18, 2002, 11:19:10 PM11/18/02
to
I'm converting some old Opro/BP7 data with a TBCD field to Delphi 6 (with
Systools 3.03). All the data converts just fine except for the TBCD fields.
Every function from StBCD that I try gives me an EAccessError at line 791:

------------------

{$ELSE}

{unpack digits}

for I := 1 to BcdSize-1 do begin

UB[2*I-1] := B[I] and $F;

UB[2*I] := B[I] shr 4;

end;

{set last overflow digit to zero}

UB[2*BcdSize-1] := 0;

{$ENDIF}

{copy sign/exponent}

UB[0] := 0;

Exponent := B[0] and NoSignBit; <----------------- error occurs

here

Sign := B[0] and SignBit;

end;

------------------

I've tried many different ways to read this data, including using BcdExt,
FloatFormBcd, StrBcd, and they all seem to fail in the Unpack function at
the same line. I've examined the field data coming in, and it appears to
be a 10 byte BCD. I thought that an EAccessError was probably related to a
memory location not being present, but I haven't had any luck in finding the
problem here. A friend of mine using the same source and destination
libraries has been successful with BcdExt, but I'm stumped. Can you help?

Carl Scorup


Robert Love [TPX]

unread,
Nov 21, 2002, 11:28:41 AM11/21/02
to
I have not worked with the BCD but let me give it a shot.
If the A/V occurs o the following line...

> Exponent := B[0] and NoSignBit;

I would guess that B[0] is the cause, is B[0] a valid index or is the
array 1 based. It is the first time in your code that you have looked at
the [0]
position.

Robert Love [TPX]

"Carl Scorup" <csc...@charter.net> wrote in message
news:jxSdRL4...@tpsmail01.turbopower.net...

Carl Scorup

unread,
Dec 4, 2002, 11:49:38 PM12/4/02
to
I appreciate your help, but I don't think that's it. The data is a standard
TBcd 10 byte BCD value. When I look at it with debugger, it looks like:
(65, 0, 0, 0, 0, 0, 0, 48, 20, 16). In hex, it is ($41, $0, $0, $0, $0, $0,
$0, $30, $14, $10)
This should be correct, since the value in the DOS app is 10.143.
So, apparently the windows app is reading the DOS value correctly. I can
even store the value in a TBcd variable in my Delphi program, but any
attempt to convert it to something else, even a string, results in the
error. I'm either really dumb or really stumped, or both. I'd appreciate
any suggestions.

Carl


"Robert Love [TPX]" <rober...@tpx.turbopower.com> wrote in message
news:eLFiosXk...@tpsmail01.turbopower.net...

0 new messages