B. Terminal Monitor : Terminal Monitor Macros : Basic Concepts
 
Share this page                  
Basic Concepts
All macros are defined as two parts: the template part and the replacement part. The template part establishes a symbol that, when encountered in the Terminal Monitor workspace, signals the Terminal Monitor to invoke the symbol's definition. When a macro is encountered, the template part is removed and replaced with the replacement part.
For example, the template ret, when read by the Terminal Monitor, causes the corresponding definition of ret to be invoked. If the replacement part of the ret macro is retrieve, all instances of the word ret in the query text are replaced with the word retrieve. For example: part and the replacement part. The template part is replaced at execution time by the replacement part. For example, the following macro definition specifies the macro template ret is to be replaced by the QUEL retrieve statement:
{define; ret; retrieve}
After you define the ret macro, QUEL replaces the macro ret with retrieve. For example, if you issue the following statement:
ret (p.all)
the Terminal Monitor expands the ret macro as follows:
retrieve (p.all)
Macros accept parameters, specified as single letters (or digits) preceded by a dollar sign, such as $2 or $k. For example, the template get $1 enables the get macro to accept a single parameter. If the get macro is defined as:
retrieve (p.all) where p.pnum = $1
typing get 35 retrieves all information about part number 35.