When to Use the Compiler

Once you have developed an application system, you have four alternative approaches to using it.

  1. You can choose not to compile any part of the application.

You can compile the programs at any time during the development of your application. We recommend, however, that you test and debug all programs fully before compiling them, as testing and debugging are most easily undertaken when executing interpretively.

  1. You can choose to compile only certain critical programs.

If you choose to compile only those application programs that are used frequently or that require considerable processing time, the performance of your application improves.  You can still modify the application easily –  non-compiled programs can be modified without being re-compiled. The resulting application could be run on the Development system or the Professional Runtime system.

  1. You can choose to compile the entire application.

This alternative gives you better system performance than alternative two. It also prevents unauthorized alteration of the programs that control the application. Application users are still able to formulate ad hoc queries and reports. Application users with a Development system can add their own documents (including additional programs), entity sets, relationships, and so on, to the application, because all application development features are present (see Deploying a Zim Application for further details on which files you can make available to users).

About the Compiler

The Zim Compiler is used to compile application programs.

The Compiler reads the programs that you have written (source code) and produces object code. The compiled code is placed into a disk file separate from the disk file that contains the source code.

The compiled version of an application program is semantically equivalent to the source program, but can be executed more efficiently, because syntactic and semantic analysis is no longer required.

Compiled programs are encrypted and are therefore completely unreadable by others. You can distribute this unreadable (and un-modifiable) version of your program, thus protecting your source code from unwanted viewing and modification.

Compiled programs can be run by the Development system, the Runtime system, or the Professional Runtime system. The Runtime system is a special, concise version of Zim; it can run only fully compiled applications. The Professional Runtime system is similar to the Runtime system, but it also enables ad hoc query and report commands to be executed interpretively.

To benefit from the Compiler, you do not need to compile all of the programs in an application. Compiled programs can call uncompiled programs, and vice versa. However, if you do compile an entire application system, you can run the application using the Runtime system, which occupies much less memory than the Development system or the Professional Runtime system.

Note: The Professional Runtime system and the multi-user Runtime system are optional products that are not automatically included in the basic software package. If you wish to obtain these optional products, contact ZIM Technologies International Inc. The single-user version of the Runtime system is included in the basic software package as a “right-to-copy” package.

Prerequisites for Compilation

To be compiled, an application program must meet the following requirements:

  • The program can not include commands that assign values to macros such as

let =’Employees’.

  • The program cannot call local macros (i.e., <0> to <9>).

  • The program can call global macros (i.e., ), but the compiled version uses the value of the macro as it existed at compile time. Later changes in the value of the macro have no effect on the compiled code.

  • The program cannot include object manipulation commands (commands that define, create, or erase objects). Application objects must be defined outside of compiled programs.

Note: The CREATE INDEX and ERASE INDEX commands can be compiled.

  • The program cannot include the commands COMPILE, PARSE, and GENERATE (the Compiler ignores these commands).

  • The program cannot include the ACCESS and RELEASE commands (the Compiler ignores these commands).

  • Care must be exercised if the program uses temporary result sets. Anomalies can occur when commands that produce temporary result sets are compiled (see The Correct Use of Objects in a Compiled Program, for more information).

You should thoroughly test and debug all programs belonging to an application before compiling them.

Furthermore, before you compile an application program, you can also use the PARSE command to assist you ensuring that the program is syntactically correct.

Compiling and Uncompiling Zim Programs

The COMPILE Command

To compile an application program, issue a COMPILE command that names the application document containing the program.

COMPILE <a-document-name>

The COMPILE command reads the program, compiles it, and stores the compiled version in a separate disk file. The source program is then marked as being compiled. Thereafter, the compiled version of the program is used when that program is called.

Error Handling

As the Compiler processes an application program, it reports any errors that it finds in the command statements. The syntactic and semantic checks performed during compilation are identical to those performed when the program is parsed (using the PARSE command) or when the source program is run interpretively.
Provided that no fatal errors are detected, the Compiler completes the compilation (success). If a fatal error is detected (e.g., no room on disk, unable to open a file), the compilation terminates.
If the compilation is successful, the compiled program is stored, and the source program is marked as “compiled”. If non-fatal errors occur, the document can still be marked as “compiled”. However, a compiled program that has raised non-fatal errors during compilation may not execute properly.

The UNCOMPILE Command

This command only changes the compilation status of the program thus marking this program as not compile but does not touch the disk file that contains the compiled version of the program.

UNCOMPILE <a-document-name>

Conventions

A number of conventions are used throughout this guide to indicate how to enter commands. These include:

Key Combinations

When you are to press two keys at the same time, they are written as Key1+Key2. This means that you should hold Key1 down and then press Key2.

Command Syntax

When the general syntax of a Zim:X command is illustrated, the command syntax uses these rules:

SyntaxDescription
Any TextTypewriter-style words that are not underlined (e.g., ZOMList) are to be entered as written. This includes all punctuation marks (i.e., commas, periods, colons, parentheses, etc.) except for those noted below.
Any TextTypewriter-style words that are underlined (e.g., formname) are to be replaced with appropriate entries of the indicated type.
[ ]Items in brackets ([ ]) are optional. The brackets themselves are not entered.
An exception is the subscript notation used in connection with variables and form fields. Array variables and repeating forms or form fields are distinguished by a number that appears in brackets. For example: RepeatingField[3]. In this case, the brackets must be entered.
|| ||Vertical lists bounded by parallel lines ( || || ) indicate a group of possible options, at least one of which must be chosen. The lines themselves are not entered.
<< >>Items bounded by the symbols << and >> can be repeated one or more times. Unless otherwise noted in the individual descriptions, each item in such a series is separated from the next by a space.
|Items that are separated by a vertical bar (|) indicate a choice of one of the given items.
ABCIn text descriptions, all commands, keywords, and operating system utility names appear in uppercase letters (e.g., SET EXCEPTION, ZIMINIT).
Italic ItemsItalic items (e.g., path) are to be replaced by entries of the appropriate type (e.g., the characters nn are to be replaced by a number).
PunctuationCommas, periods, colons, parentheses, etc. are to be entered exactly as written.

Note: Zim:X makes no distinction between uppercase and lowercase letters in identifying command names. However, in operating systems such as LINUX, the case of operating system utilities is important. All operating system utility names should be entered in lower case.

Entering Commands and Instructions

The following table describes the methods by which commands and instructions can be entered:

enterType the given information and press the Return or Enter key.
pressPress the given key, or key combination, once.
usePress the given key, or key combination, as often as necessary to achieve the desired result.

 

pt_BRPortuguese