The purpose of a Macro is to standardize functions that are common to several programs, or to several procedures of the same program. A called Macro is a complement to the generation possibilities of the system. A Macro is usually displayed in a program description as if its lines had been directly entered by a programmer.
A Macro is not a subprogram because, unlike a subprogram, a Macro can contain non-consecutive statements.
However, a Macro can call a subprogram.
This type is generally a combination of elementary technical functions that you must rewrite in order to minimize the task of connecting elementary Macros to one another;
You must often decide whether to use a subprogram or a Macro to consolidate all the procedures that are common to several Programs.
You can parameterize the key of specific code lines (function code, subfunction code, and the first two characters of the line number). As a recommendation, before writing a Macro, you must try to structure the procedure to be written. If you minimize the number of parameters in the key, you facilitate the Macro use, obtain programs with a homogeneous structure, and minimize the resolution time of a Macro.
As a rule, it is not recommended to use a Macro instead of one or two specific code lines. Using specific code is less time-consuming upon generation and limits the number of necessary Macro calls.
Documenting a Macro is important. It gives the developer the information needed to use the Macro properly: the meaning of each parameter, which functions, subfunctions, or both, are used.
Given the same key, the lines of a Macro are overridden by the lines of the calling program (Program or Screen entity). It is advised to design Macros so that as few lines as possible will be overridden by the calling programs. The maintenance is easier.