Bob, problem fixed. Thank you for your help!
Looked at your parse-time error explanation again this morning after a good nights sleep and there it was: the perfect workaround!
I just have to enclose the max() function with an if...endif pair as follows:
if StartIndex <= 0 then Println symbol, ",", StartIndex, ",", Max(-1, StartIndex, hi); endif;
Take away the if...endif and the scan presents you with a syntax error "Day value must be less <= 0". Even while the StartIndex IS a negative number.
Sent the following bug report to Gary:
--- end of email to Gary ---
Please run the following scan:
// start of scan
input="test-stocks-in.lst"; output="test.lst";
integer i, Startindex; DaysToLoad=2200; StartIndex :=(DaysLoaded-1) * -1;
Println symbol, ",", StartIndex, ",", Max(0, StartIndex, hi);
// end of scan
on this "test-stocks-in.lst" containing the following symbols:
CATP EMC IM AMCC SCMM BEST
You will note that you get an error message:
"Syntax error: Day value must be less <= 0"
The day value IS <= 0. You can easily check that in the following way:
Change the Println line to this:
Println symbol, ",", StartIndex;
Run the scan and you'll get this:
CATP ,-1326 EMC ,-1394 IM ,-424 AMCC ,-155 SCMM ,-190 BEST ,-195
All the StartIndex values are there, and they are all correctly negative numbers.
So the "Syntax error: Day value must be less <= 0" is INCORRECT.
Therefor the bug must be in the Max() parsing routine.
I used a workaround presented to me by Bob Jagow that makes the scan work. You have to enclose the Prinlln statement with and if endif as follows:
if StartIndex <= 0 then Println symbol, ",", StartIndex, ",", Max(-1, StartIndex, hi); endif;
Thank you.
--- end of email to Gary --- Awesome program QPv2 and you guys in the thread, especially Bob, are just as awesome. Great thread guys. Thx.
Johan |