Posted by Robert G Laurin on April 08, 2015 at 09:21:10:
I have this weirdest problem which I am not sure how to test...
I have this nightly process that runs through a couple of million records every night. Among many things it writes a pointer file which are orders for documents in the form 'X99' where X is one of a couple of the letters and 99 is anything between 01 and 99.
This 20 year old program runs fine when compiled in Comet16 but when compiled with Comet32 it does not, sometimes, build the document id properly: for document 'M20' it says 'M00'. It looks like it is the only document id which is wrong... The next program that prepares the documents crashes on document index 0 (Comet16).
The code is a mess but the M20 code is one of the simple one. It can't go wrong but yet it does and because of the sheer volume of data and the few occurrences of M20 it is impossible to trace.
Code looks a bit like this:
Let cStatus$ = 'C' ! Set to completed
cSTDate$ = ZCDATE$ ! Completion Date
Let CNInfo$ = 'Changed Status to Completed'
Let COL = 20 ! Set Letter to 20-Completed (this is a 2.0)
If cBalDue > 5 Let COL = 21 ! Oops, still owe more than $5.00 - 21-Balance Due
Goto SendMLetter ! Order M20 Letter
Let cMLetter$ = RSub(Str(100+COL),2,2) ! Convert to String 1-99 -> 01-99
cMDate$ = ZCDATE$
Let oLetter$ = 'M' + cMLetter$
Gosub OrderLetter ! Write Letter Record
Again, this happens only for M20 letter. I can find it by looking at the Notes for each occurrence where it says 'Status changed to Completed'. It writes a Note at every letter it orders and there is no way around the code that sets COL=20 and COL=21 works every time. Nowhere else does it set COL to 20 or 21.
I really don't see how C32 could compile this wrong.... Yet it looks like it does.
The compiled source is over 4 thousand lines that includes 41 usefiles. It uses 27 datafiles.
It makes it kind of hard to produce a "sample data" to recreate it.
How can we figure this one out?
Post a Followup
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.