Skip to content

Repeated Clause

The REPEATED clause arranges body groups side-by-side across the page.

repeated clause

Repeated Clause: Coding Rules

  • Write this clause at the 01-level of body groups (DETAIL or CH/CF) only.

  • You must code either the TIMES phrase or the EVERY/WIDTH phrase, or (preferably) both. EVERY and WIDTH have the same meaning.

  • Code only the left-hand report group. Report writer will automatically offset successive groups to the right of the left-hand group.

  • If you use the EVERY/WIDTH phrase, draw an imaginary "smallest box" around your group:

    repeated smallest box

    The width of your box must not be greater than the EVERY/WIDTH integer-2. If any of your lines can have a variable rightmost column position, you must use the maximum expected size while drawing your box, but report writer cannot always predict the actual size at precompilation time. If the actual width of the group then causes it to encroach into the area occupied by the group to its right, a run time error will be issued.

  • There are no other restrictions on the size of your group or the clauses that you can use within it. For example, you may specify any number of LINES.

  • If you omit the TIMES phrase, report writer will examine your EVERY/WIDTH phrase and calculate how many repetitions of the group it can fit within the LINE LIMIT. If you use the identifier form of the LINE LIMIT clause, report writer will do this dynamically when you GENERATE the groups.

  • If you omit the EVERY/WIDTH phrase, report writer will examine your TIMES phrase and will calculate how widely it can space the repeats of your group at regular intervals. You cannot use the identifier form of the LINE LIMIT clause in this case.

  • The rightmost column of the rightmost REPEATED group must not go beyond the LINE LIMIT. This possibility can arise only if you use both the TIMES phrase and the EVERY/WIDTH phrase. In all other cases, report writer does the fit for you and makes sure that the repeats will fit side-by-side without violating the LINE LIMIT.

  • The REPEATED clause is not allowed in a report group that has no LINE clauses.

Repeated Clause: Operation

  • If you code a REPEATED clause in a DETAIL group, report writer will place consecutive groups side-by-side:

    side-by-side

    Each instance of the group is produced by one GENERATE. For example, to produce the above 3-up pattern, you would issue three successive GENERATEs. Each instance may display different data and may differ from its companions in certain characteristics by virtue of any PRESENT or OCCURS... DEPENDING clauses that you have coded.

  • Report writer sets up a buffer to hold your repetitions. If your group is REPEATED three times, as in the diagram above, this is what happens:

    • First GENERATE: The group is not produced but is placed in the buffer; the special register REPEATED-COUNTER is set to 1.

    • Second GENERATE: The second group is also not produced but is placed in the buffer; REPEATED-COUNTER is set to 2.

    • Third GENERATE: All three groups are produced side-by-side, with the second and third groups offset by the number of columns given in the EVERY phrase. The buffer is then cleared, ready for the next three groups. REPEATED-COUNTER is reset to zero.

    The starting point for the repetitions is given by the COLUMN numbers in your group description. These will become the COLUMN numbers of the left-hand group. The following example shows the effect obtained:

    group starting point

    If a different body group is produced, no more groups are placed side-by-side and any groups already in the buffer are output. Any unused repetitions will result in blanks on the right-hand side. The effect of writing:

    different body groups

    where group-A and group-B are DETAIL groups and A is REPEATED 3 TIMES. Group B may also be REPEATED, but even if it is also REPEATED 3 TIMES, it will not be printed alongside group A, but will start a new series of repetitions. The same effect is seen if your program issues a TERMINATE when there are groups still in the buffer. report writer will first produce them with blank unused entries on the right, so that no data will be lost.

  • If you need to have different groups placed side-by-side, you will have to define a single group and use the PRESENT WHEN clause above several LINE entries to create the impression of different groups at run time.

  • If a control break occurs that results in a CONTROL HEADING or CONTROL FOOTING group, it has the same effect as when you GENERATE a different DETAIL group. That is to say, any groups in the buffer are first output. This is true even if your CONTROL group is a dummy (with no LINE clauses to cause output). Briefly, your groups always appear in chronological order.

  • If a clause in your group references LINE-COUNTER (in a condition or as a SOURCE), you will always obtain its correct effective value. report writer updates LINE-COUNTER just as though the group were actually being output, although the group is being placed in a buffer in memory. Then, when the next group is GENERATEd, LINE-COUNTER immediately reverts to the value it had at the start of the preceding group.

  • The page-fit test is applied to each repetition in turn. So, if your REPEATED group has a depth that may vary (because of a PRESENT WHEN clause or an OCCURS...DEPENDING at LINE level), room must exist for the largest group that has been GENERATEd in the current "pass" across the line.

  • You may place a REPEATED clause in a CONTROL HEADING or CONTROL FOOTING group, but this is of no use except when you use summary reporting (GENERATE report-name), because there is no other way that the same CONTROL HEADING or CONTROL FOOTING group can appear twice in succession.

Compatibility

The REPEATED clause is unique to new Report Writer.

Back to top