PRIVATE and PUBLIC keywords

PUBLIC and PRIVATE keywords are valid only for module declarations of variables and user data types. They cannot be used in global or local declarations, where they will cause compilation error.

 

By default a module variable or a programmer defined data type are private, which means they are visible only inside the module where they are declared. To declare a private variable you may use the PRIVATE keyword or use the DEFINE statement without any preceding keyword.

 

The private variables and programmer defined data types are not visible to the other modules of the same program, they are also not visible, if the module is imported using the IMPORT statement.

 

To make a public declaration, use the PUBLIC keyword before the DEFINE statement. Public module variables and data types are visible from within other modules of the same program and can are also visible, if the module is imported using the IMPORT statement.

 

Here are some examples of public declarations:

PUBLIC DEFINE     var INT,

                  rec RECORD

                       mem1 STRING,

                       mem2 DATE

                  END RECORD

 

DEFINE st_var STRING --not visible outside the module

PRIVATE DEFINE p_var MONEY -- not visible outside the module

 

PUBLIC DEFINE mytype TYPE AS RECORD

                       m1, m2, m3 STRING

                       END RECORD

FUNCTION func()

...

 

 

 

Contact Us

Privacy Policy

Copyright © 2026 Querix, (UK) Ltd.