Page 106 - DCAP507_SYSTEM_SOFTWARE
P. 106
System Software
Notes 7.2.1 Concatenation of Macro Parameter
Most Macro Processor permits parameters to be concatenated with other character strings.
A program comprises a set of series of variables:
XA1, XA2, XA3,…
XB1, XB2, XB3,…
If similar processing is to be performed on each series of variables, the programmer
might want to fit in this processing into a macro instruction.
The parameter to such a macro instruction could specify the series of variables to be
functioned on (A, B, C …).
The macro processor builds the symbols by concatenating X, (A, B, …), and (1,2,3,…) in the
macro expansion.
Let such parameter is named &ID, the macro body may comprise a statement: LDA X&ID1,
in which &ID is concatenated after the string "X" and before the string "1".
LDA XA1 (&ID=A)
LDA XB1 (&ID=B)
Ambiguity problem: E.g., X&ID1 may mean "X" + &ID + "1""X" + &ID1. This problem
appears since the end of the parameter is not marked.
Macro Definition
Macro Invocation Statements
100 LOVELY PROFESSIONAL UNIVERSITY