Working with Routines and Include Files
A routine is the unit of execution in an InterSystems IRIS server; all application logic running on an InterSystems IRIS server is executed by invoking routines and entry points in routines. Routines are executed in a virtual machine that is built into the InterSystems IRIS server environment. Routines are portable to all platforms supported by InterSystems IRIS and automatically shareable across an InterSystems IRIS environment.
Include files (.inc
files) contain macro definitions (or other include files) and can be included in .mac
routines or class definitions. For more information on macros, see the section “Using Macros
” in Using ObjectScript
Using the Routine Editor, you can directly create and edit the source for routines or include files. The Routine Editor uses syntax coloring and indicates syntax errors with a wavy red line.
When class definitions are compiled, the class compiler generates a set of routines containing the implementation for the class. If you want to view and edit this generated source code, you must specify that the compiler should keep a copy of the generated code. To keep a copy of the generated code:
There are several kinds of routine source formats (files) in InterSystems IRIS. The Routine Editor provides syntax coloring and checking for each of these formats. The formats include:
By default, when you create a new ObjectScript routine, it is saved as a .mac
to save this as a different type of routine (changing the extension from .mac
to display .int
code corresponding to a given .mac
file and vice versa.
To create a new routine or include file, select
. A dialog displays the templates you can choose from. For an include file, select ObjectScript. This opens a new Routine Editor window with a default name, such as Untitled
. You can save this with a different name with
Open an existing routine with
. In the drop-down list of Files of Type
, select the file extension of interest (such as .mac
, or All Files
) and select a routine.
When you attempt to open a previously saved routine or include file, the Open
dialog uses wildcard matching (using the * (asterisk to match any number of any character) and ? (question mark to match a single character) to display a list of available routines or include files. The routine type - BAS, MAC, INT, or INC - is used as a file extension for purposes of wildcard matching.
When you create a new routine in Studio, it opens a new Routine Editor window. If a Routine template file exists, it is copied into the new file. To create a Routine template file, create a file with the contents that you want in your template. Save the file as Default.mac
in the same directory as the Studio executable file (CStudio.exe
You can save routines to the database by selecting
. By default, saving a routine does not cause it to be compiled. To change this behavior so the routine is compiled every time it is saved:
To compile a routine directly, select
(which also causes it to be saved).
To delete a routine, in a Workspace window, highlight the routine and select
. The routine and any generated files are deleted.
When you save an existing routine (or include file), Studio automatically creates a backup file. It automatically saves up to five backup files, naming them with a ;#
(semicolon number) suffix. For example, a file named setup.MAC
which has been saved six times has five backup files named:
To see what backup files exist, use a semi-colon in the search field of the
option. You can use the following syntax examples:
||Displays all backup files in this folder.
||Displays all backup files with a .MAC extension.
|| Displays all backup files named setup.
You can use this syntax to find backup files when you are opening routine and include files from the Management Portal. To open backup files from the Management Portal:
Select Management Portal from the InterSystems IRIS launcher.
Content Date/Time: 2019-05-14 06:55:27