

The macro mechanism allows a flexible (dynamic) use of table and column names. Without having to modify an application statically, i.e., within the program text, it can work on tables which have the same structure but differ partly in table or column names. Such a name can be equated with a three-digit number between 1 and 128 (syntax: %number) by means of the SQL statement 'set macro'. The number can be inserted into an SQL statement at those positions where tables or columns must be specified. The runtime system of the ADABAS precompiler replaces the number by the name which has previously been specified in the set macro statement. Macro definitions apply to all program units of an ADABAS application (modules, subprograms translated separately, etc.); i.e., a macro value can be defined in one program unit and be used in another one. Host variables can contain table or column names. These names must be declared as strings with a length of up to 30 characters.
Example:


