Overview | Creating a GRIP Program | Linking GRIP Object Files | Running a GRIP Program | Debugging a GRIP Program
Actions the Compiler Performs
| Sample GRIP Compiler Listing


Compiling a GRIP Program

The second step in the GRIP development process is to convert your source file to an object file. The object file consists of a special code generated by the GRIP compiler. During this step, the compiler analyzes each line of your source program generates a list which consists of statements, labels, variables, and any errors recognized by the compiler. If the compiler detects no errors, it generates and saves an object file.

Source File Lines

GRIP lines in the source file are limited to 80 bytes per line. The number of characters on a line is determined by the character set used. For example, if the character set uses two bytes for each character, you can have 40 characters per line. For three bytes per character, you can have 26 characters per line.

For UTF-8 character encoding, see Support for Internationalized Characters.

Before You Compile

When the GRIP compiler converts the source file statements it produces a listing. This listing can consist of source statements, variable storage locations, labels, and errors (the default option) or errors only. Before you compile, you can determine the contents of this listing using option 7, Compile Listing in GRADE.

You can also change the default compile option to "errors only" by setting the environment variable UGII_ERRONLY to 1.

Compiling and Linking in GRADE

To start the compiler, use the Compile option in GRADE.

Compiling a Single File

To compile a single file, enter a single line compile command by specifying: c <filespec>, where filespec is a full pathname or just a filename if it resides in your current directory. You can exclude the .grs file extension.

Compiling Multiple Files

To compile multiple files, specify a file template, such as *.grs. This compiles all the files in your current directory with a .grs extension.

When the Compile is Complete

If the GRIP source file compiles without any errors, the compiler automatically generates a GRIP object file and files it in the default directory.

If errors occur, the object file is not created and the system lists the errors as set in option 7, Compile Listing.

Identifying Interactive vs. Batch Programs

GRIP programs can operate in two modes: interactive or batch. Batch programs cannot contain interactive programming statements. If the program compiles successfully, the last line of the compiler listing specifies if the program can be run in interactive, batch or in interactive only. If the program is run in either mode the line reads: UNIVERSAL LINK FILE. If the program can be run only in the interactive mode the line reads: INTERACTIVE LINK FILE.