Potential Problems

The Compiler works from top to bottom through a program, reading every command line and disregarding programming structures and the flow-of-control commands (such as IF&ldots;ENDIF, WHILE&ldots;ENDWHILE, BREAT, CONTINUE, RETURN, STOP, and BYE). During compilation, the software creates a result set for every set-processing command that implicitly or explicitly produces a result set.

For example, compilation of the command

find Employees WorkOn Projects where DeptNum = 'D01" -> EmpSet

results in the creation of a result set called EmpSet. The components of EmpSet are Employees, WorkOn, and Projects, in that order.

When the Compiler creates the result set, it is concerned only with the structure of the set (i.e., the components and their order). If EmpSet is a set object, its structure (as defined in the Object Dictionary) must match the structure used in the application program statement.

Two situations exist in which problems can arise when references to result sets are compiled:

In certain commands (e.g., LET, IF), a reference to a database field implicitly means that field in the current result set.

When a program is executed interpretively, the current result set is the set produced by the most recently executed FIND or SET CURRENTSET command.

When a program is being compiled, the current result set is the set produced by the most recently encountered FIND or SET CURRENTSET command.

Because the Compiler works top-to-bottom through a program, at some point in the body of the program, the current set last encountered can differ from the current set that would have been last produced were the program being executed interpretively.

All temporary result sets are created in the session directory.

When a program is executed interpretively and a result set name is re-used, the new version of that result set - produced by the most recently executed set-producing command - replaces the original version.

When a program is being compiled and a result set name is re-used, the new version of that result set - produced by the most recently encountered set-producing command - replaces the original version.

Because the Compiler works top-to-bottom through a program, at some point in the body of the program a particular set name can refer to a set whose structure differs from that of the set that would be in effect were the program being executed interpretively.

This situation can be eliminated by having the software check that the structure of a temporary result set never changes during an application session (SET CHECKSETS ON), or by using a set name for which a structure has been permanently defined (set object).