Previous Page | Next Page

Enabling ARM Macro Execution

Conditional ARM Macro Execution for ARM

It is useful to code the ARM macros in your program, but to execute them only when they are needed. All ARM macros support a LEVEL= option that specifies the execution level of that particular macro.

If the LEVEL= option is coded, then the execution level of the macro is compared to two global macro variables, _ARMGLVL and _ARMTLVL. _ARMGLVL is the global level macro variable. If the LEVEL= value on the ARM macro is less than or equal to the _ARMGLVL value, then the macro is executed. If the LEVEL= value on the performance or ARM macro is greater than the _ARMGLVL value, then the macro is not executed:

     /*  Set the global level to 10 */   
  %let _armglvl = 10;  

data _null_;   
  %arminit(appname='Appl 1', appuser='userid' );
  %armgtid(txnname='Txn 1', txndet='Transaction #1 detail' );
 
    /*  These macros are executed */   
  %armstrt( level=9 );   
  %armstop( level=9 );  

    /*  These macros are executed */   
  %armstrt( level=10 );   
  %armstop( level=10 );  

    /*  These macros are NOT executed */   
  %armstrt( level=11 );
  %armstop( level=11 );    

  %armend 
run;

_ARMTLVL is the target level macro variable and works similarly to _ARMGLVL, except the LEVEL= value on the ARM macro must be equal to the _ARMTLVL value for the macro to execute:

     /*  Set the target level to 10 */   
  %let _armtlvl = 10;  

data _null_;   
  %arminit(appname='Appl 1', appuser='userid' );
  %armgtid(txnname='Txn 1', txndet='Transaction #1 detail' );
 
    /*  These macros are NOT executed */   
  %armstrt( level=9 );   
  %armstop( level=9 );  

    /*  These macros are executed */   
  %armstrt( level=10 );   
  %armstop( level=10 );  

    /*  These macros are NOT executed */   
  %armstrt( level=11 );
  %armstop( level=11 );    

  %armend 
run;

The LEVEL= option can be used in any ARM macro, which is highly recommended. It enables you to design more granular levels of logging that can serve as a filter by logging only as much data as you want. If you set both _ARMGLVL and _ARMTLVL at the same time, then both values are compared to determine whether the macro should be executed.

Previous Page | Next Page | Top of Page