Skip to main content

#include

Loads a specified file name that contains preprocessor directives.

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.

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 pre-processed 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")
Note:

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)
} 

When including files at the beginning of a class, the directive does not include the pound sign. Hence, for a single file, it is:

Include MyMacros

For multiple files, it is:

Include (MyMacros, YourMacros)

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
FeedbackOpens in a new tab