Potential Problems

Potential Problems

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

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:

  • Implicit references to the current set.

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.

  • Re-use of the name of a temporary result set.

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).

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish