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

        .macro CHECK_PROCEDURE_KIND PROCEDURE_KIND
            OK = 0      ; Assume procedure_kind is unknown
            .irp REFERENCE_KIND,BOUND,NULL, REGISTER,STACK
                .if identical, <PROCEDURE_KIND>, <REFERENCE_KIND>
                    OK = 1 ; Procedure_kind is known
                    .mexit ; No need to look further
                .endc
            .endr
            .if eq, OK  ; If unknown procedure kind
                .error "Unknown procedure kind: PROCEDURE_KIND"
            .endc
        .endm CHECK_PROCEDURE_KIND

        CHECK_PROCEDURE_KIND REGISTER
        CHECK_PROCEDURE_KIND FOOZLE

      The macro call and expansion of the previously defined macro is
      as follows:

        CHECK_PROCEDURE_KIND REGISTER
            OK = 0      ; Assume procedure kind is unknown
            .if identical,<REGISTER>,<BOUND>
            .endc
            .if identical,<REGISTER>,<NULL>
            .endc
            .if identical,<REGISTER>,<REGISTER>
                OK = 1 ; Procedure kind is known
                .mexit ; No need to look further
            .if eq, OK  ; If unknown procedure kind
            .endc

        CHECK_PROCEDURE_KIND FOOZLE
            OK = 0      ; Assume procedure kind is unknown
            .if identical,<FOOZLE>,<BOUND>
            .endc
            .if identical,<FOOZLE>,<NULL>
            .endc
            .if identical,<FOOZLE>,<REGISTER>
            .endc
            .if identical,<FOOZLE>,<STACK>
            .endc
            .if eq, OK  ; If unknown procedure kind
                .error "Unknown procedure kind: FOOZLE"
            .endc

      In this example the CHECK_PROCEDURE_KIND macro uses the
      .IRP directive to iterate over a list of reference keywords
      to determine if its argument matches one of the reference
      keywords. If a match is not found, the macro displays an error
      message.
Close Help