$INCLUDE Compiler Directive

Top  Previous  Next

 

The $INCLUDE directive is used to direct the compiler to include text from another record. Include records may be in either directory or dynamic files.

 

$INCLUDE { filenamerecord.id

 

For compatibility with some other systems, $INSERT may be used as a synonym for $INCLUDE.

 

 

Examples

 

$INCLUDE SYSCOM ERR.H

$INCLUDE MYKEYS.H

 

The first example includes record ERR.H from the SYSCOM file. The second example, which has no file name specified, includes MYKEYS.H from the same file as the source program.

 

Use of a .H suffix is recommended on include records as these will be skipped automatically by the compiler when using a select list.

 

The file name in the first $INCLUDE is not strictly necessary as the compiler will always look in SYSCOM if no file name is given and the include record is not found in the same file as the source program.

 

Because directory files on non-Windows platforms have case sensitive record names, the compiler will look for the record name as entered and then, if it has not been found, in uppercase. Thus programs may be written in either upper or lowercase if the records are always stored with uppercase name. The standard include records in the SYSCOM file follow this rule.

 

Include files may be nested (one included from within another) though this can lead to difficulties when maintaining complex programs and is discouraged.

 

For compatibility with other multivalue databases, the $INCLUDE directive can also be written without the $ prefix. Used in this way, it must be the only statement on the source line.