#include
Description
This macro preprocessor directive loads a specified file name that contains preprocessor directives. It has the form:
#include <filename>
where filename is the name of the include file, not including the .inc suffix. Include files are typically located in the same directory as the file calling them. Their names are case-sensitive.
The #include syntax loads a single include file. You can use multiple #include lines as needed.
Variation: Include Files for a Class
Within a class definition, you can make include files available for the entire class by using a variation of this syntax, as follows:
Include MyMacro
Class MyPackage.MyClass {
}
Notice that the directive does not include the pound sign. For multiple include files, provide a comma-separated list, enclosed in parentheses, for example:
Include (MyMacros, YourMacros)
Elsewhere within the class definition, you can load include files for use within a specific class member. In this case, use individual #include lines, each with a single include file name.
Variation: Include Files in a Stored Procedure
When using #include in stored procedure code, it must be preceded by a colon character :, such as:
CREATE PROCEDURE SPxx() Language OBJECTSCRIPT {
:#include %occConstant
SET x=##lit($$$NULLOREF)
}
Listing Available Include Files
To list all of the system-supplied #include filenames, issue the following command:
ZWRITE ^rINC("%occInclude",0)
To list the contents of one of these #include files, specify the desired include file. For example:
ZWRITE ^rINC("%occStatus",0)
To list the #include files preprocessed when generating an INT routine, use the ^ROUTINE global. Note that these #include directives do not have to be referenced in the ObjectScript code:
ZWRITE ^ROUTINE("myroutine",0,"INC")
Example
For example, suppose there is an OS.inc header file that contains macros:
#define Windows
#define UNIX
#include OS
#ifDef Windows
WRITE "The operating system is not case-sensitive.",!
#else
WRITE "The operating system is case-sensitive.",!
#endif