‎2008 Nov 05 9:37 AM
What does the Ampersand-2 and 1(&2 and &1 ) contain in this code?
DEFINE DBG.
IF DEBUGFLG = 'Y' OR DEBUGFLG = 'y'.
IF &2 NE SPACE.
WRITE: / &1, &2.
ELSE.
WRITE: / &1.
ENDIF.
ENDIF.
END-OF-DEFINITION
‎2008 Nov 05 9:39 AM
It's the placeholder for the parameters you pass to the macro.
Example.
DBG 'value 1' ' value 2'.
&1 will get the value ' value 1' and &2 gets 'value 2'
‎2008 Nov 05 9:42 AM
‎2008 Nov 05 10:12 AM
Its the placeholders for your parameter you pass while calling the MACRO.
For example if you call a macro as;
MACRO1 var1 var2.....Then here the var1 will be passed to &1, var2 passed to &2 and so on.
Got it?
Regards
Karthik D
‎2008 Nov 05 10:39 AM
hi ,
Ampersign are place holders . In a macro , maximum of 9 place holders can be used.
Advantage is reusability
for example
DATA : a TYPE i,
b TYPE i,
c TYPE i.
DEFINE mac1.
a = &1.
b = &2.
c = a &3 b.
write : / c.
END-OF-DEFINITION.
mac1 2 3 +. " this is for addition
mac1 2 3 *. " this is for multiplication
mac1 6 2 /. " this is for division
mac1 4 2 -. " this is for substractionThanks & Regards
‎2008 Nov 05 10:40 AM