Previous Topic: RENUMBER CommandNext Topic: RESET Command


Repeat Line Command

The repeat line command duplicates a line or range of lines. Lines duplicated with the repeat line commands are inserted immediately after the line containing the repeat line command (R) or the ending repeat range line command (RR).

This command has the following format:

   {R }   
[n]{RR}[n]
R

Specified on the line to repeat.

RR

Used in pairs to indicate the start and end of a range of lines to repeat. The second occurrence of this command on the same or subsequent screen is interpreted as the end of the range.

After specifying the start of a range with the RR line command, you can scroll the region forward or backward and perform other line commands. Until the end of the range started by an RR line command is found, the PENDING message appears in the message line.

n

Optionally specifies the number of times (between 1 and 100) the line or range of lines is repeated. If you do not specify n, the line is repeated once. The SET EDIT MULTIPLIER command determines whether n is placed on the left or right. For example,

If multiplier is set with:

then you specify:

SET EDIT MULTIPLIER RIGHT

R7

SET EDIT MULTIPLIER LEFT

7R

When interpreting line commands that mark ranges of lines to repeat, the commands are matched into pairs from the top down, regardless of the order in which you entered the line commands.

The inserted lines are assigned sequence numbers in increments of one, starting from the previous existing line. When the number of inserted lines exceeds the number of integers between the sequence numbers of the existing lines, the sequence numbers on the lines following the insertion are changed. (See the following example.) To renumber the sequence numbers, refer to the RENUMBER primary editing command.

Example

The following example shows the use of the repeat line command. Line 100 contains a line command that repeats a line twice.

=> ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.... IDEAL: PROCEDURE DEFINITION PGM CRTEST (001) TEST SYS: $ID FILL-IN Command....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. ====== ================================ T O P ================================

2R0100 SET NEXT_PANEL = 'EMPMENU' 000200 WHEN $PF12 000300 DO TERMINATE_SES 000400 WHEN OTHER 000500 FOR EACH EMPLOYEE 000600 SET STATE1 = 'CA' 000700 SET STATE3 = 'MO' 000800 SET STATE2 = 'IL' 000900 WHERE STATE_ADDRESS = 'CA' OR 'IL' 001000 AND NUMBER > 125 AND < 150 001100 FOR PAYROLL 001200 WHERE NUMBER = EMPLOYEE.NUMBER 001300 AND NUMBER > 100 AND < 150 001400 SET SALARY = YTD_WAGES + YTD_COMMISSION - YTD_TAX 001500 PRODUCE CARM1 001600 ENDFOR 001700 ENDFOR

The following example shows the repeated lines with sequence numbers assigned (101 and 102).

=> ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.... IDEAL: PROCEDURE DEFINITION PGM CRTEST (001) TEST SYS: $ID FILL-IN Command....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. ====== ================================ T O P ================================ 000100 SET NEXT_PANEL = 'EMPMENU' 000101 SET NEXT_PANEL = 'EMPMENU' 000102 SET NEXT_PANEL = 'EMPMENU' 000200 WHEN $PF12 000300 DO TERMINATE_SES 000400 WHEN OTHER 000500 FOR EACH EMPLOYEE 000600 SET STATE1 = 'CA' 000700 SET STATE3 = 'MO' 000800 SET STATE2 = 'IL' 000900 WHERE STATE_ADDRESS = 'CA' OR 'IL' 001000 AND NUMBER > 125 AND < 150 001100 FOR PAYROLL 001200 WHERE NUMBER = EMPLOYEE.NUMBER 001300 AND NUMBER > 100 AND < 150 001400 SET SALARY = YTD_WAGES + YTD_COMMISSION - YTD_TAX 001500 PRODUCE CARM1 001600 ENDFOR

In the following example, lines 1000 and 1400 contain line commands that repeat a range of lines.

=> ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.... IDEAL: PROCEDURE DEFINITION PGM CRTEST (001) TEST SYS: $ID FILL-IN Command....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. ====== ================================ T O P ================================ 000100 SET NEXT_PANEL = 'EMPMENU' 000101 SET NEXT_PANEL = 'EMPMENU' 000200 WHEN $PF12 000300 DO TERMINATE_SES 000400 WHEN OTHER 000500 FOR EACH EMPLOYEE 000600 SET STATE1 = 'CA' 000700 SET STATE3 = 'MO' 000800 SET STATE2 = 'IL' 000900 WHERE STATE_ADDRESS = 'CA' OR 'IL' RR1000 AND NUMBER > 125 AND < 150 001100 FOR PAYROLL 001200 WHERE NUMBER = EMPLOYEE.NUMBER 001300 AND NUMBER > 100 AND < 150 RR1400 SET SALARY = YTD_WAGES + YTD_COMMISSION - YTD_TAX 001500 PRODUCE CARM1 001600 ENDFOR

The following example shows the repeated lines inserted after line 1400 with sequence numbers assigned (1401 through 1405).

=> ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+.... IDEAL: PROCEDURE DEFINITION PGM CRTEST (001) TEST SYS: $ID FILL-IN Command....+....1....+....2....+....3....+....4....+....5....+....6....+....7.. ====== ================================ T O P =============================== 000100 SET NEXT_PANEL = 'EMPMENU' 000101 SET NEXT_PANEL = 'EMPMENU' 000200 WHEN $PF12 000300 DO TERMINATE_SES 000400 WHEN OTHER 000500 FOR EACH EMPLOYEE 000600 SET STATE1 = 'CA' 000700 SET STATE3 = 'MO' 000800 SET STATE2 = 'IL' 000900 WHERE STATE_ADDRESS = 'CA' OR 'IL' 001000 AND NUMBER > 125 AND < 150 001100 FOR PAYROLL 001200 WHERE NUMBER = EMPLOYEE.NUMBER 001300 AND NUMBER > 100 AND < 150 001400 SET SALARY = YTD_WAGES + YTD_COMMISSION - YTD_TAX 001401 AND NUMBER > 125 AND < 150 001402 FOR PAYROLL 001403 WHERE NUMBER = EMPLOYEE.NUMBER 001404 AND NUMBER > 100 AND < 150 001405 SET SALARY = YTD_WAGES + YTD_COMMISSION - YTD_TAX 001500 PRODUCE CARM1 001600 ENDFOR