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

edited May 3 in OpenInsight
I get an "Illegal Statement" error on a 'Lock' statement:lock table.File, AllOrderNo then lockObtained = 1 endIf 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 = 1Maybe the compiler fails to check for a space delimiter after the 'All' keyword.
This of course works:lock table.File, null then lockObtained = 1And this of course fails the compiler:lock table.File, nullthen lockObtained = 1But this code actually compiles and runs:lock table.File, Allthen lockObtained = 1It 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 endthe 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

  • What specifically are you wondering about? You make some interesting observations (which were honestly a surprise to me) but somewhat par for the course with Revelation. I am not sure I caught the issue you are still puzzled about.
  • I did not expect 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.
  • I see. I thought you already came to the conclusion that this likely a problem with the compiler being overly zealous with the variable starting with the name of a keyword and this isn't anything on you. It just seems to be an unexpected (and unwanted) behavior. I don't think there is more to the story than that.

    The low-level compiler routine is RTP5. You can examine the object code and glean the datetime it was last compiled.
  • Yes, I had come to that conclusion, but I wanted another pair of eyes to be sure I wasn't jumping to conclusions. Thanks for your assessment. I really should see if I can get a Works account.
    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.
  • edited May 3
    Maybe it is an old bug that will disappear with an upgrade to OI 10.

    Just tested. Sadly this is not the case.
Sign In or Register to comment.