Was this helpful?
Include Scripts
Include scripts are scripts that contain 4GL code that you can include anywhere in your frame, procedure, or user class script by using the #include statement. This statement references an include script component in the current or an included application.
Your 4GL code block does not appear in the frame script until after the script has been processed. In the preprocessed version, you see only the #include statement and the name of your script as described in The #include Statement.
You can use include scripts for:
Code sharing that cannot be accomplished by including the code in a called procedure or method—for example, blocks of code that include on event statements or conditions
Variable definition
Include scripts can exist in your current application or in any included application. You create and edit include scripts in OpenROAD Workbench by using the Include Script Editor. You can also display a list of include scripts for an application in the Components portlet of the Develop tab. For more information about how to use this option, see the Workbench User Guide.
The #include Statement
The syntax for an include statement is:
# include scriptname
scriptname
Specifies the name of the include script you want to reference
Use an #include statement for each script of 4GL code you want to reference in a frame script. The 4GL code must not be in the file system, it must be in the database.
The # sign must begin in the first column. Spaces are not required between the # sign and the rest of the statement. However, the number of white spaces between "#" and "include" are prefixed to every line in the processed include script. For example, if you want to indent the included code by four spaces, then enter the #include as "#   include" (with three spaces following the #).
The #include statement can be nested to a depth of 20.
General Preprocessor Statement Rules
Macro variables are substitution parameters that you can define and give a value. The preprocessor, when it encounters a macro variable in the source file, substitutes the name with its defined value. In the case where the defined value is a character string, the value substituted does not contain the delimiting quotation marks. A macro variable's scope is global to the frame being generated from the point in the file where it is defined.
There are two types of macro variables that you can use in your 4GL code for preprocessing purposes:
User-defined macro variables
You define these in the Frame Editor or Procedure Editor, or in your source script.
Built-in macro variables
The OpenROAD preprocessor determines the value of these macro variables each time you compile. You can use these, but you should not change their values.
The following sections describe how to use preprocessor statements with these macro variable types.
Comments in Preprocessor Statements
Preprocessor statements, which start with “#” in position 1, may contain an end-of-line comment.
Comments begin with “--” and contain everything to the end of the line. For example:
# include scriptname --This is a comment
Starting the line with “#--” comments out the entire line:
#-- This line is a comment
Preprocessor comments do not appear in the processed script.
Last modified date: 12/20/2023