'How to declare local variable (Allen Bradley studio 5000)

How to declare local variable in structured Text in Allen Bradley studio 5000. I have tried the following which did not work. mnemonic/syntax is not recognized?

VAR
   x: INT;
END_VAR

global variables do work as, TEST_INPUT and TEST_INPUT_BOOL are globally declared.

IF TEST_INPUT.0 THEN
    TEST_INPUT_BOOL := 1;
ELSE
    TEST_INPUT_BOOL := 0;
END_IF;
plc


Solution 1:[1]

In Allen-Bradley RSLogix 5000 / Studio 5000, local tags (variables) are not declared inline in structured text routines. Instead, tags are defined in the Tag Browser. "Controller Tags" holds the controller-scoped (global) tags, and each Program has its own "Parameters and Local Tags" section where the program-scoped tags are defined. Tags shown in the Local Tags section of a program can be used in any routine in that program.

Once you add your program-scoped tag to the appropriate Tag Browser, you can use the tag in your structured text routine. If you try to use a tag that is not declared as either a program-scoped or controller-scoped tag, you will get a verify error.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ben Miller - Remember Monica