Divide 0 error

GCC Consulting gcc at optonline.net
Thu May 20 16:51:49 PDT 2004


Problem:

When updating an order's total amount, total cost, dollar profit and profit %,
in a few cases I get a /D0 error in both the dollar profit and % profit fields.

This update is run from the header record using lookups to the detail file.  The
header fields are blanked prior to this calc being run.

Total_amount=total_amount+(ord(5)*ord(7))  'ord(5)=qty shipped  ord(7)=selling
price
Total_cost=total_cost+(ord(5)*ord(12))	 'ord(12)=cost

After all details records have been retrieved,

Dollar_profit=total_amount-total_cost
Profit_percent=dollar_profit/total_amount

In checking the order detail associated with one of the orders with the /D0, all
of the related fields have proper values.  

Why the dollar_profit field has a /D0 is a mystery as there is no division
taking place.

After updating about 1000 orders this occurred on 4 orders had the above
problem.

Anyone have any suggestion as to why or where to look.  Yes, I used the debugger
on this process and still can't see where the problem is.

Richard Kreiss
GCC Consulting 




More information about the Filepro-list mailing list