VMS Help  —  MACRO  /ALPHA  Directives  .NARG  Examples
      Example 1
      The macro definition is as follows:

        .MACRO  CNT_ARG A1,A2,A3,A4,A5,A6,A7,A8,A9=DEF9,A10=DEF10
        .NARG   COUNTER         ; COUNTER is set to no. of ARGS
        .WORD   COUNTER         ; Store value of COUNTER
        .ENDM   CNT_ARG
      Example 2
      The macro calls and expansions of the macro previously defined
      are as follows:

        CNT_ARG TEST,FIND,ANS   ; COUNTER will = 3
        .NARG   COUNTER         ; COUNTER is set to no. of ARGS
        .WORD   COUNTER         ; Store value of COUNTER

        CNT_ARG                 ; COUNTER will = 0
        .NARG   COUNTER         ; COUNTER is set to no. of ARGS
        .WORD   COUNTER         ; Store value of COUNTER

        CNT_ARG TEST,A2=SYMB2,A3=SY3      ; COUNTER will = 1
        .NARG   COUNTER         ; COUNTER is set to no. of ARGS
        .WORD   COUNTER         ; Store value of COUNTER
                                ; Keyword arguments are not counted

        CNT_ARG ,SYMBL,,        ; COUNTER will = 4
        .NARG   COUNTER         ; COUNTER is set to no. of ARGS
        .WORD   COUNTER         ; Store value of COUNTER
                                ; Null arguments are counted
Close Help