DBFNTX/1021 Data Width Error?

311 views
Skip to first unread message

dbo...@gmail.com

unread,
Jun 13, 2024, 12:02:41 AMJun 13
to Harbour Users
In a do while/skip loop, I replace a CURRENT (balance) with CURRENT+1 and get a data width error AND the value if 200+1 shows as 277705.8540.
This is after processing a few records.
I know the value of CURRENT is between 100 and 300.
CURRENT Field is N 8.2.
I do understand data width errors - and I'm not anywhere near that.
Windows 10.
HBMK2 2.2.0dev
Code is so simple that it just can't be the code.
SET DECIMALS TO 2
Any ideas?
Dave

Message has been deleted

jmcqu...@gmail.com

unread,
Jun 13, 2024, 1:33:53 AMJun 13
to Harbour Users
n,8,2 means 5 integer and 2 decimals
277705.8540 needs 6 integer and causes overflow.
Decimals will be be truncated.

José M. C. Quintas

pete....@gmail.com

unread,
Jun 13, 2024, 1:37:45 AMJun 13
to Harbour Users
On Thursday 13 June 2024 at 07:02:41 UTC+3 dbo...@gmail.com wrote:

Code is so simple that it just can't be the code.
Well, usually, IT IS the code...
Hint: instead of CURRENT+1 try alias->CURRENT +1 
and see if it makes any difference.
(where `alias` the alias of dbf with the FIELD `CURRENT`)


dbo...@gmail.com

unread,
Jun 16, 2024, 8:54:08 PMJun 16
to Harbour Users
Sorry - I wasn't clear.  The value of  277705.8540 was just an example of an insane return value.  The value returned is an impossible value. That's why I'm wondering about a memory error or ?.

The code is like replace pbclient->current (N,8,2) with pbclient->current + pbclient->units x pbclient->price (per unit like 200 x $1) and it runs for a few dozen records, then crashes with dbcx data width error however, the result of the units x price calc could never be much more than $200 and the new total current balance could never be more than $5000 (current) or so.   No realistic chance of a real data width error.  I do check the record where it crashes and units & price fields are fine - like 200 and 1.  Simply can't get high results like  27,0000 etc.   I delete the offending record/pack and it crashes on a different record - again, with values that are too low to cause data width.   I'm working remote to my client via TeamViewer.  Wonder if the Harbour dbcx driver has any known version concerns.
Thanks!
Dave

AL67

unread,
Jun 17, 2024, 7:10:04 AMJun 17
to Harbour Users
Maybe you missed the record change - SKIP command, and you are updating the same record multiple times.

Adam

cod...@outlook.com

unread,
Jun 17, 2024, 7:54:57 AMJun 17
to Harbour Users
Hi

It is always error which say that value is greater then N8.2. 
Try to follow value of  pbclient->current + pbclient->units x pbclient->price , step by step. 
You do not need any special IDE. In loop I use simply  ? pbclient->current + pbclient->units x pbclient->price  and wait. With this I can see what is happening. 
If there are menu loop steps to point of error, then include some step counter and activate display with ?  at some desired point.

Regards,
Simo.

José M. C. Quintas

unread,
Jun 17, 2024, 1:15:35 PMJun 17
to harbou...@googlegroups.com
It is not memory error, it is the limit on database.

Create a routine to test.

nTotal := 0

DO WHILE ! Eof()

   nValue := pbclient->units * pbclient->price

   IF value > 5000 .OR. value < 5000

      ? RecNo(), value

   ENDIF

nTotal += nValue

   SKIP

ENDDO

? nTotal


José M. C. Quintas

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/4d3e0eab-5572-43ce-8bd4-5f1e60a5ab13n%40googlegroups.com.

dbo...@gmail.com

unread,
Jun 18, 2024, 12:03:16 AMJun 18
to Harbour Users
Thank you for all of the help.
Solved.
I FINALLY downloaded the client's data for my testing and found that a user had keyed in 999.99 for cost and 9999.99 for quantity sold and the product of cost * sell was more than the data structure allowed.   We will either widen it out, or we can edit for that, or we can fire the user.  They thought testing in the production database was OK.
Lesson:  When things work at home, but not at the client, download the client data for home testing!
( I knew that, but forgot it ).
;-)

Dave Bonnar

unread,
Jun 18, 2024, 12:11:27 AMJun 18
to harbou...@googlegroups.com
Thank you José M. C. - 
Dave



You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/y5fxXcTwMeI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/44800ef0-36d6-49dd-b6cd-85297d795327%40gmail.com.


--
Dave Bonnar
(559) 801-3273 (text & voice)

Mario H. Sabado

unread,
Jun 18, 2024, 12:32:03 AMJun 18
to harbou...@googlegroups.com
Hi,

You can get the max value of the numeric field  then compare the computed value to trap if it exceeds the field limit.

nLimit := Val( Replicate("9",FieldLen("NUM_FIELD"))+"."+Replicate("9",FieldDec("NUM_FIELD") )

Regards,
Mario


Mario H. Sabado

unread,
Jun 18, 2024, 1:16:46 AMJun 18
to harbou...@googlegroups.com
should be:

nLimit := Val( Replicate("9",FieldLen("NUM_FIELD")  - (FieldDec("NUM_FIELD") +1)  )+"."+Replicate("9",FieldDec("NUM_FIELD") )

since Decimal is sub part of FieldLen()

Hurricane

unread,
Jun 18, 2024, 11:25:38 PMJun 18
to Harbour Users
Hi Dave,

Email me the original DBF file in zip (or RAR, 7Z) format.
I have a suspicion, if it is confirmed, I will post the solution here. One of several situations that I have identified before and corrected.

note:
Guys, when posting questions in the group, always provide a small snippet of code.

Regards,
Eric, Systems Analyst
Em quinta-feira, 13 de junho de 2024 às 01:02:41 UTC-3, dbo...@gmail.com escreveu:

kamlesh patel

unread,
Jun 19, 2024, 1:51:46 AMJun 19
to harbou...@googlegroups.com
Hi,

Which version of harbor are you using?

Please check the old version in compile and check.
I think harbour  new version in bug.

Regards
Kamlesh
  

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Francesco Perillo

unread,
Jun 19, 2024, 3:09:14 AMJun 19
to harbou...@googlegroups.com
Sorry I don't have the first messages of the thread but in your case I'd extrapolate the routine in a new program and add a lot of debugging messages, listing all the fields, then on the next line, the result of the multiply.

I'd also ask a someone else to look for typos or faults in the logic of the code, there may be something that you are not seeing since you know the code (you think to know the code :-))))

Anyway, I'd add debugging ? to the code:
? "record:" , recno(), pbclient->current, pbclient->units, pbclient->price   // LIST THE ORIGINAL VALUES
? "Calculated: " pbclient->current + pbclient->units x pbclient->price  // PRINT THE CALCULATED VALUE

and SKIP becomes
? "old:", recno() ; SKIP ; ? "new:", recno()

Sorry if these ideas seems basic but I don't know your code...




Reply all
Reply to author
Forward
0 new messages