Declarations

Grouping of variable declarations

Group variable declarations into logical blocks. Separate those blocks using blank lines.

The AS and NO-UNDO phrases should be formatted in tabular fashion.

All variables have to be declared at the beginning of a routine level block. The ABL currently (subject to change in the future) only supports variables scoped to a routine level block (compile unit, class, method, procedure, …) and not to simple blocks like a DO, FOR EACH or REPEAT. So we want to make the scope of a variable clear by enforcing where it’s placed.

DEFINE VARIABLE cEntity AS CHARACTER NO-UNDO. DEFINE VARIABLE cTables AS CHARACTER NO-UNDO. DEFINE VARIABLE cQueries AS CHARACTER NO-UNDO. DEFINE VARIABLE cJoins AS CHARACTER NO-UNDO. DEFINE VARIABLE iNumRecords AS INTEGER NO-UNDO. DEFINE VARIABLE hFindDataset AS HANDLE NO-UNDO. DEFINE VARIABLE cInitialContext AS CHARACTER NO-UNDO. DEFINE VARIABLE iPos AS INTEGER NO-UNDO. DEFINE VARIABLE lWaitStateActive AS LOGICAL NO-UNDO. DEFINE VARIABLE cQueryString AS CHARACTER NO-UNDO. DEFINE VARIABLE lPositionWasZero AS LOGICAL NO-UNDO INIT FALSE .

Parameter definitions

All Parameters should be defined at the beginning of a PROCEDURE or FUNCTION.

Class Variables

Variables should be defined without the package name to enhance readability of source code.

DEFINE VARIABLE ... AS {unqualified class of ...} NO-UNDO .