Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clipper changing data under Win 95?

Status
Not open for further replies.

unit512

MIS
Mar 12, 1999
233
US
This may be a programming error of ours, but we have been unable to find it.<br><br>We have a client running a Clipper 5.2x compiled program. In the program (its a Payroll system)... the total hours (lets say 40) x the rate ($10) from file A gets transferred to file B.<br><br>So... File A field1 = 40 x field2 = 10 goes into File B fieldA=400.<br><br>However, every time they transfer 1 or 2 records get changed.&nbsp;&nbsp;There is NO consistency and it is always a different record.<br>In this case File B may get $390 instead of $400.<br><br>We are trying to find a code error, but are also wondering if anyone ever found this to be a DOS under Win95 problem as well?<br><br>Thanks,<br>Glenn Abelson
 
Hi Glenn Abelson,<br><br>&nbsp;&nbsp;&nbsp;I am not sure whether the situation you are facing is same as mine or not, Clipper seen like having problem with decimal calculaton, for example;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;fileB-&gt;Pay&nbsp;&nbsp;&nbsp;:= fileA-&gt;Hours * fileA-&gt;Rate<br><br>it work fine.<br><br>But if you use a variable to calculate the total,<br><br>&nbsp;&nbsp;&nbsp;nRate&nbsp;&nbsp;:= 3.2567<br>&nbsp;&nbsp;&nbsp;nHours := fileA-&gt;Hours<br>&nbsp;&nbsp;&nbsp;nPay&nbsp;&nbsp;&nbsp;:= nRate * nHours<br><br>&nbsp;&nbsp;&nbsp;replace fileB-&gt;Pay with nPay<br>&nbsp;&nbsp;&nbsp;commit<br><br>&nbsp;&nbsp;&nbsp;nPay := 0<br><br>it work fine for the first few time (assume that you put it in a DO WHILE loop). After that nPay is not given you the correct result.<br><br>if you use Clipper @SAY, alert() or qout() to look at the value in nPay, it give you a &quot;0&quot; result, but if you do something like this;<br><br>&nbsp;&nbsp;&nbsp;if nPay = 0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Zero&quot;)<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Not Zero&quot;)<br>&nbsp;&nbsp;&nbsp;endif<br><br>it always go to false condition.<br><br>&nbsp;&nbsp;&nbsp;So what I did was, after using a variable for calculation, I always assign it back to zero with something like this;<br><br>&nbsp;&nbsp;&nbsp;nPay := val(str(0,10,2))<br><br>where the decimal is same as the one in your database.<br><br>Hope this could help you.<br><br>YewMun <A HREF="mailto:yewmun@mailcityasia.com">yewmun@mailcityasia.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top