Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Compiler error on a 'Lock' statement
I get an "Illegal Statement" error on a 'Lock' statement:
I found that 'All' is a keyword in a 'Lock' statement. Any variable that has the prefix 'All' causes the error, including 'All_Order_No'. The compiler or parser probably expects to see the keyword 'Then' or 'Else' immediately after it encounters the word 'All'.
I understand that a variable name cannot be the same as a keyword, but I would not expect a variable that starts with a keyword to be a problem. For example, this 'Lock' statement compiles and runs:
This of course works:
Then again, I would not be surprised, after my last snafu, if I've missed some Basic+ 101. Anyone know what is happening here?
lock table.File, AllOrderNo then
lockObtained = 1
end
If I use 'AlOrderNo' instead of 'AllOrderNo', the compiler does not object.I found that 'All' is a keyword in a 'Lock' statement. Any variable that has the prefix 'All' causes the error, including 'All_Order_No'. The compiler or parser probably expects to see the keyword 'Then' or 'Else' immediately after it encounters the word 'All'.
I understand that a variable name cannot be the same as a keyword, but I would not expect a variable that starts with a keyword to be a problem. For example, this 'Lock' statement compiles and runs:
lock table.File, nullAllOrderNo then lockObtained = 1
Maybe the compiler fails to check for a space delimiter after the 'All' keyword. This of course works:
lock table.File, null then lockObtained = 1
And this of course fails the compiler:lock table.File, nullthen lockObtained = 1
But this code actually compiles and runs:lock table.File, Allthen lockObtained = 1
It locks the table apparently. (With my limited knowledge I know not how to determine this apart from running the program again and observing the failure of another lock-attempt. Form Designer and Table Builder do not indicate that the table is locked, though when I unlock it withunlock table.File, Allelse
// 'Unlock' error-handling.
null
end
the next attempt to lock the table succeeds.)Then again, I would not be surprised, after my last snafu, if I've missed some Basic+ 101. Anyone know what is happening here?
Comments
lock table.File, AllOrderNo then lockObtained = 1
to fail the compiler, and I would report a compiler bug except that I wanted to check that I haven't missed something obvious (e.g. getting the syntax wrong) by getting into the details.By the way, is there a way to determine the compiler version, or is it tied up with the version of OI.
The low-level compiler routine is RTP5. You can examine the object code and glean the datetime it was last compiled.
The version of the compiler I use is old: 2007. Maybe it is an old bug that will disappear with an upgrade to OI 10.
Just tested. Sadly this is not the case.