108
Chapter 6 Buffered Forms
Repeat
The Repeat command repeats a sequence of Code V commands and data a
user-specified number of times. The number of times to repeat a comman d or
data sequence is specified in the data section of a Buffered Form Execute
command. The manner in which this is done is best understo od by referring to
Example 1 below.
The Repeat command has the following format:
Command ^R^<data>^Z^-
Arguments
^R^ Repeat Command
<data> The data to be repeated.
^Z^- End of Repeat Terminator
Example 1:The Repeat comman d always occurs within the Buffered Form
Create command data sequence. The number of times to repeat
a portion of the data sequence is specified within the buffere d
Form Execute command data sequence.
NOTE: The Repeat command is used in the following Code V sequence:
^IFORM,CEXAMPLE1^G^R^-^M0201000Repeat ^[020^-^*^*^Z^-^]
^R^- The beginning of the Buffered Format Re peat
command. Everything between the ^R^- and the ^Z
will be repeated.
^[020 The data field with a maximum size of 20 bytes.
^Z^- The end of the commands and data to be repeated.
Now we want to execute the Form EXAMPLE1. The first four bytes of the
Execute data field must specify the number of times to repeat the data
sequence between the ^R and the ^Z. the next 20 bytes will be read fro m the
Execute data sequence, then the following four bytes specify the number of
times to repeat the data sequence again, and so forth until all the data in the
Execute command is used up.
NOTE: Each time the Create data sequence is repeated by the Repeat
command, the same Execute data is used to fill the data fiel d. The
Copy command, however, inserts new Execute data into the data
field each time the data field is repeated.
The Execute command sequence for EXAMPLE1 is:
^IFORM,EEXAMPLE1^G
0003 3 Times^+(Repeats 3 Times, three times.
0002 2 Times^+(Repeats 2 Times, twice)
^G
prints: