Attention

IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.

P2003

Code

P2003

Message

Enumeration type declaration has duplicated value

This error occurs when an enumeration type declaration has duplicate values.

Example

The following code will generate error P2003:

TYPE
    LogLevel : (CRITICAL, CRITICAL) := CRITICAL;  (* Error: Duplicate value *)
END_TYPE

The enumeration has two values with the same name CRITICAL, which is not allowed.

To fix this error, ensure all enumeration values are unique:

TYPE
    LogLevel : (CRITICAL, WARNING, INFO, DEBUG) := INFO;  (* All values unique *)
END_TYPE