You are here: Core Reference > Coding > Logic > Using the RETAIN Keyword in an ST Program

Using the RETAIN Keyword in an ST Program

Normally, internal variables are not stored for use after the program or server has been reset. Similarly, they are not transferred to any standby servers.

However, it is possible to store internal values so that:

To do this, you need to use a RETAIN keyword. The RETAIN keyword instructs the program to store the internal variable so that it can transferred and used after a reset.

In ST programs, you need to use the following format to retain the internal variables:

VAR RETAIN

<Value name> :<Value type>;

END_VAR

Example:

VAR RETAIN

TempConversion: INT;

END_VAR

Where TempConversion is the name of the internal variable and INT is the type of value that it represents (an integer).


ClearSCADA 2015 R2