COMPILE

From Recital Documentation Wiki
Jump to: navigation, search

Purpose

Compile one or more program files


Syntax

COMPILE <filename>| (<expC>)


See Also

CERROR(), DB_COMPMULICOMM, DO, ED, MODIFY COMMAND, SET COMPILE, SET DEVELOPMENT, SET PROCEDURE, SET PSHARE, VI


Description

The COMPILE command translates the source code of the specified program files into object code, and creates a file containing that object code. The object files created by the COMPILE program have the same basename as the program file, but a file extension that ends with an "o". In most cases, the execute-only object code in these files runs much faster than the program files. The gain in speed is dependent on the number and size of the DO WHILE, DO CASE and IF constructs within the program.

Unless the full filename is specified in the <filename> argument, the COMPILE program looks for a file in the current directory and path (see SET PATH) with a .prg extension. COMPILE accepts any file or combination of files that contain source code. You may specify an expression that returns a file name or group of file names, as COMPILE will use all files matching the specified file pattern. The <filename> can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.

You cannot modify or de-compile an object file; you can only modify the source file. The MODIFY COMMAND, ED and VI commands can be used to modify the source file. If SET DEVELOPMENT is ON, and SET COMPILE is ON, the DO command compares the time and date stamp of a source file with the time and date stamp of its associated object file. If the object file is older than the source file, then DO will recompile the source file before executing it.

In Recital Terminal Developer environments, program files must be compiled before they can be accessed from a server or runtime license. Compiled programs can be run from the operating system prompt as follows:

dbrt <compiled program name>


Example

compile *.prg


Products

Recital Server, Recital