Skip to content

Wrap Clause

The WRAP clause is used to produce an automatic wrap round to a new continuation line when the next field will not fit on the current line.

wrap clause

Wrap Clause: Coding Rules

  • The AFTER phrase gives the rightmost column number that any field may occupy before wrap round becomes necessary. If integer-1 is specified, it must lie in the range 1 to maximum line width. Its value acts as a maximum line width for any lines in its scope. The rightmost column position of every entry with an absolute COLUMN must therefore not exceed integer-1. If identifier-1 is specified, a similar check is made at run time. If the phrase is omitted, a value of the LINE LIMIT is assumed for integer-1 and, if the identifier form of LINE LIMIT is in use, its value will be computed, as usual, at INITIATE time. Thus, by default, lines are allowed to reach the usual page width before wrap round.

  • The TO phrase gives the column number at which printing continues after wrap round. If integer-2 is specified, it must lie in the range 1 to maximum line width. If identifier-2 is specified, a similar check is made at run time. If the phrase is omitted, a value of 1 is assumed for integer-2. Thus, by default, a line wraps round to column 1.

  • The STEP phrase gives the relative vertical offset for any continuation lines. If the phrase is omitted, a value of 1 is assumed for integer-3 . Thus, by default, a line is continued onto the immediately following line. If a PAGE LIMIT clause is present in the RD, the value of integer-3 is used by the precompiler in calculating the (maximum) vertical size of the group to check that it will fit correctly into its assigned region of the page.

  • WRAP may be coded either (a) in an entry containing a LINE clause or (b) at a higher level having one or more LINE entries beneath it. This second possibility allows you to avoid repeating the same clause in several LINE entries.

  • Only relative COLUMN entries are allowed to cause wrap round. If a LINE entry has a WRAP clause, the COLUMN entries forming the description of the line must end in one or more relative COLUMN entries. Entries with absolute COLUMN numbers still cannot exceed the maximum line width.

  • A superfluous WRAP clause is not permitted. So the COLUMN entries (in particular the trailing relative COLUMN entries) must be such that the LINE LIMIT could be exceeded. (If this is not foreseeable at precompilation time, it will be assumed that this could happen at run time.)

  • If the WRAP clause is coded at a higher level with more than one LINE entry beneath it, it is sufficient if at least one of the LINE clauses obeys these rules. For example, it is permissible to code the WRAP clause at the 01-level, even if only one of LINE entries in the group can cause wrap round. However, in general any number - even all - the LINE entries in a report may be capable of causing wrap round.

  • The format b NO WRAP clause is allowed only at a level subordinate to a format a WRAP clause. The entry containing NO WRAP must represent more than one physical elementary printable field. No other nesting of the clause is permitted.

Wrap Clause: Operation

  • The WRAP clause causes data to wrap round automatically to a new continuation line when the next field or group of fields will not fit on the line. It may be used in any TYPE of report group. The point where wrap round begins is always after a complete elementary field. Hence a horizontal "fit test" is performed before each field is output, unless it has an absolute COLUMN or is known to fit. (Compare the "page-fit test" performed in the vertical direction.) If the field's right-hand column would extend beyond the column position given in the AFTER phrase, the line is output without the field and then space-filled. The field in question is now placed in the new line, starting in the column position given in the TO phrase. The initial spacing implied by the "PLUS integer" of the COLUMN clause is ignored. The vertical line spacing is given by the STEP phrase.

    If the identifier form of the AFTER or TO phrase is used, the identifier's current value is used.

    The following complete example shows how a variable number of error messages may be output:

    validation report

    The phrase AFTER COL 64 gives the last column that can be occupied by any field in the line. The phrase TO COL 36 gives the starting column for the wrap round. STEP 1 is assumed in default, so continuation is onto the next line. Note that the initial spacing implied by the "+ 3" of the first COLUMN clause on the new line is ignored.

  • As well the conditional case just described, where the continuation line appears in exceptional circumstances, it is possible (though less useful) for the wrap round to occur every time, as in this example:

    wrap around

    which is exactly equivalent to:

    equivalent wrap around

  • Horizontal Fit Test - The "fit test" takes into account a field's variable length. By changing the PICTUREs in the previous example to make them variable length, we have the following, more common, situation:

    horizontal fit test

    The longer names in this layout are a good example of the rare conditions that have to be allowed for, but which, without this special feature, often take up a disproportionate amount of programming effort.

  • If the containing group is a body group beginning with a relative LINE clause, the continuation lines are taken into account during the group's page-fit test. For example, if only two lines are available for the printing of the last group in the preceding example, a new page would be started:

    containing group

    whereas in all the other instances the group would fit on the current page.

  • When an OCCURS clause or a Multiple LINES Clause is coded at the same level as WRAP, the WRAP clause applies separately to each occurrence.

  • NO WRAP indicates that the entries subject to NO WRAP must appear together in the same line. The horizontal "fit test" is therefore performed before the entire set of fields is output to ensure that they are not to split over a line boundary. (Compare NO MULTIPLE PAGE which does the same for the page boundary.) When an OCCURS clause is coded at the same level as NO WRAP, the NO WRAP clause applies separately to each occurrence. The following example lists names across several lines, keeping initials and surnames together:

    no wrap

Compatibility

The WRAP clause is unique to new Report Writer.

Back to top