You are on page 1of 9

Macro

www.tutors161.com

Definition
2

Abbreviation for a group of statements Concept of re-usability Saves time of developer Saves space for developer Causes extra processing Separate processor module is required

www.tutors161.com

Structure of Macro
3

MACRO Macro_Name optional_argument ---------------------------------------MEND

www.tutors161.com

Termnology
4

Macro Definition Macro Call Macro Expansion

www.tutors161.com

Macro Call
5

Within assembly program, asking a macro to execute

at particular location can be defined as macro call. Example: Using 100 A DS 10 Macro_Name End

www.tutors161.com

Macro Expansion
6

Replacing the macro call statement with its macro

definition. Example: Using 100 A DS 10 ---------------------------------------------End


www.tutors161.com

Conditional Macro Expansion


7

2 Pseudo Ops permit conditional re-ordering of the

sequence of macro expansion.

AIF
AIF

is a conditional branch pseudo-op which performs an arithmetic test and branches only if the tested condition is true. is unconditional branch pseudo-op. It is similar to GOTO statement. Which is used to jump to particular instruction label in the program.

AGO
AGO

www.tutors161.com

Macro Calls within Macro


8

Example:
MACRO ADD1&ARG L A ST MEND MACRO ADDS ADD1&ARG1 ADD1&ARG2 ADD1&ARG3 MEND

1, &ARG 1, =F1 1, &ARG

&ARG1, &ARG2, &ARG3

www.tutors161.com

Macro Calls defining Macros


9

Example of MACRO DEFINITION within Another MACRO DEFINITION MACRO DEFINE &SUB MACRO &SUB &Y CNOP 0,4 BAL 1,*+8 DC A(&Y) L 15,=V(&SUB) BALR 14,15 MEND MEND Example of MACRO CALL defining MACRO DEFINE COS

www.tutors161.com

You might also like