VMS Help  —  MACRO  /ALPHA  Directives  .REPEAT
    Repeat block directive

    Format

      .REPEAT expression
         .

         .

         .

      range
         .

         .

         .

      .ENDR

1  –  Parameters

 expression

    An expression whose value controls the number of times the range
    is to be assembled within the program. When the expression is
    less than or equal to 0, the repeat block is not assembled. The
    expression must be absolute or relocatable and must not contain
    any undefined symbols. The assembler converts a relocatable value
    to the relative offset within the psect.

 range

    The source text to be repeated the number of times specified by
    the value of the expression. The repeat block can contain macro
    definitions or other repeat blocks. .MEXIT is legal within the
    range and causes the current and all succeeding repetitions to be
    aborted.

2  –  Description

    .REPEAT repeats a block of code a specified number of times in
    line with other source code. The .ENDR directive specifies the
    end of the range.

3  –  Notes

    The alternate form of .REPEAT is .REPT.

4  –  Examples

      Example 1
      The following macro definition uses the .REPEAT directive to
      store an ASCII string a specified number of times, followed by
      a 0 byte:

        .MACRO  COPIES  STRING,NUM
        .REPEAT NUM
        .ASCII  "STRING"
        .ENDR
        .BYTE   0
        .ENDM   COPIES
      Example 2
      The following macro call stores five copies of the string
      ABCDEF. This example is divided into four parts:

      Macro invocation:

        COPIES  <ABCDEF>,5

      Macro expansion of .REPEAT invocation:

          .REPEAT 5
          .ASCII  "ABCDEF"
          .ENDR

      .REPEAT expansion:

          .ASCII  "ABCDEF"
          .ASCII  "ABCDEF"
          .ASCII  "ABCDEF"
          .ASCII  "ABCDEF"
          .ASCII  "ABCDEF"

      End of macro expansion:

          .BYTE   0
      Example 3
      The following macro call stores three copies of the string How
      Many Times. This example is divided into four parts:

      Macro invocation:

          VARB = 3
          COPIES  <How Many Times>,VARB

      Macro expansion of .REPEAT invocation:

          .REPEAT VARB
          .ASCII  "How Many Times"
          .ENDR

      .REPEAT expansion:

          .ASCII  "How Many Times"
          .ASCII  "How Many Times"
          .ASCII  "How Many Times"

      End of macro expansion:

          .BYTE   0
Close Help