1. Macro Definition Table (MDT)

  • Purpose: Stores the body of all macro definitions (i.e., instructions between MACRO and MEND).

  • Each line of a macro definition is stored in sequence.

Example:

MACRO
INCR &ARG
   ADD AREG, &ARG
MEND

MDT:

IndexInstruction
0INCR &ARG
1ADD AREG, &ARG
2MEND

2. Macro Name Table (MNT)

  • Purpose: Holds the names of defined macros and their starting index in MDT.

  • Used to quickly locate macro bodies during expansion.

MNT:

IndexMacro NameMDT Index
0INCR0

3. Macro Definition Table Counter (MDTC)

  • Purpose: Points to the next available entry in the MDT.

  • Updated as macro lines are inserted.

  • Starts from 0 and increments with every new line added.

Example:

  • Before macro insertion: MDTC = 0

  • After above macro: MDTC = 3


4. Macro Name Table Counter (MNTC)

  • Purpose: Points to the next available entry in the MNT.

  • Incremented each time a new macro is defined.

Example:

  • After defining INCR, MNTC = 1

5. Argument List Array (ALA)

  • Purpose: Maintains a list of formal parameters during macro definition and replaces them with actual parameters during macro expansion.

  • Ensures proper parameter substitution.

Macro Call:

INCR NUM1

ALA During Expansion:

IndexFormal ArgActual Arg
0&ARGNUM1
  • During expansion, &ARG is replaced by NUM1 in the instructions.

Summary Table:

StructurePurpose
MDTStores macro body (excluding MACRO keyword)
MNTStores macro names and corresponding MDT index
MDTCTracks next available index in MDT
MNTCTracks next available index in MNT
ALAManages argument substitution