Internet PLC Forum
General => Technical support => Topic started by: Steve Ebstein on February 17, 2004, 06:43:16 PM
-
When compiling a special function with lots of nested IF THEN ELSEs, I get "Unknown keyword" error that shows up a variable. I delete most of the function, it compiles, I paste the code back, it compiles, then I go to transfer the program to the PLC and it bombs on the compile with "unknown keyword". Any suggestions ?
-
You will have to carefully match each IF THEN ELSE with its own ENDIF otherwise sometimes the compiler will encounter an error that it does'nt understand and hence report as "unknown keyword".
If you still have trouble compiling that function, then send it to us at support@tri-plc.com and we can try to see what's going on.
-
I found the problem - I was misusing the IF THEN ELSE syntax. So I guess 'unknown keyword' really means 'syntax error'.
-
I've often been confused by strange behavior from the compiler. Nothing major, though, and since I recognize that it's probably no simple task writing any sort of compiler I figured the infrequent quirks aren't worth raising a stink about. Although I may compile a list of them over time to submit here just so the developers are aware of them.
-
I have seen a strange thing.. at least it seems strange to me being a native VB/QBasic programmer.. but I've noticed the you cannot include the THEN syntax in the IF THEN statement when using integer values. For example.. I have to use the following:
IF A<B
[...code]
ENDIF
however if using strings I use this:
IF STRCMP(A$, "SOME_STRING")=0 THEN
[...code]
ENDIF
If I try to include 'THEN' after integer constants or variables I get a syntax error. Maybe you can work with that and see.
This is different when using
When compiling a special function with lots of nested IF THEN ELSEs, I get "Unknown keyword" error that shows up a variable. I delete most of the function, it compiles, I paste the code back, it compiles, then I go to transfer the program to the PLC and it bombs on the compile with "unknown keyword". Any suggestions ?
-
I tried the following program fragment with both "THEN" and without "THEN" and didn't encounter any problem in either case. I used the TRiLOGI version 5.3 to test. As far as I know, the latest TRiLOGI version 5.3 has fixed some problems related to use of complex relational statement in the IF command. Maybe you like to upgrade to 5.3 and check if it take care of your reported problem.
-----code tested -----
IF STRCMP(A$, "SOME_STRING")=0 THEN
B$ = "same"
ELSE
B$ = "Not the same"
ENDIF