Today I ran through a problem with macros.
I wanted to use 2 parameters in a macro but the second parameter should also be initial.
DEFINE _where_cond. APPEND |&2 field&1 = var&1| TO dynamic_where. END-OF-DEFINITION. START-OF-SELECTION. _where_cond 1. _where_cond 2 AND.
The editor shows up the following error:
Call macro _WHERE_COND without 2. Actual parameters.
First I wanted to add an IF statement to add the AND command but I found it not “nice”.
The next idea was to define 2 macros what I also discarded as the macro was some more lines longer and I wanted to have the macro as short as possible,
The third – and final – solution was:
IF dynamic_where IS NOT INITIAL. APPEND 'AND' TO dynamic_where. ENDIF.
In the meantime I encountered another solution, which was very, very bad.
Can you guess which?
Please no discussion about not using macros anyway. thanks.