Wraps text at word spaces and moves additional text to a new line.
WRAP {line_length_lit|_var|_col} {max_lines_lit|_var|_col}[KEEP-TOP] [STRIP=strip_chars][ON=break_chars][R] [LINE-HEIGHT={line_height_lit|_var|_col}] line_length_lit|_var|_col
The maximum paragraph width in characters.
After a string wraps, the current position is one character to the right of the last character in the column. When a string ends on the last position of a line, an implicit line feed causes the new current position to be the first character of the following line. In the SETUP section, use DECLARE-LAYOUT to make the page width one character wider than the right edge of the wrapped text to avoid generating an implicit line feed.
print &comment (48,20,0) wrap 50 3 print ¬e1 (1,20,30) wrap 30 4 print ¬e2 (1,+2,30) wrap 30 4 print ¬e3 (1,+2,30) wrap 30 4
In this example, the paragraph is 50 characters wide with a maximum depth of 3 lines..The line position is 1 for each of the three wrapped fields: note1, note2, and note3. The current print position after a wrap occurs at the bottom right edge of the wrapped paragraph. To continue printing on the same line, you must use a fixed line number for the next field.
max_lines_lit|_var|_col
Specifies the maximum paragraph depth in lines.Usually, the line length and maximum lines are indicated with numeric literals. However, WRAP can also reference numeric variables or columns. This is useful when you want to change the width or depth of a wrapped paragraph during report processing. The numeric variable can optionally be preceded by a colon (:).
KEEP-TOP retains the current line position except if a page break occurs, in which case, line 1 is used as the current line position. The default action is to set the next print position at the bottom of the wrapped data.
In the following example, the column &resolution prints on the same line as the first line of the column &instructions:
print &phone (+1,10) edit '(xxx) xxx-xxxx' print &instructions (+1,10,30) wrap 6 10 keep-top print &resolution (0,+3,25)
The STRIP and ON arguments affect which characters are to convert before wrapping, and which characters force a wrap to occur.
Both arguments accept regular characters and nondisplay characters whose ASCII values are surrounded by angled brackets, <nn>.
For example, to print a long data type that contains embedded carriage returns, the setup would be:
print &long_field (5,20) wrap 42 30 on=<13>
The paragraph wraps at each carriage return, rather than at the usual word boundaries. If the ON character is not found within the width specified for the paragraph, the wrap occurs at a word space.
The following example converts the STRIP characters to spaces before wrapping on either a line feed <10> or a space (the default):
print &description (20,10) wrap 50 22 strip=/\^@<13> on=<10>
WRAP can also be used to print reversed characters, for support of languages such as Hebrew. An R after the length and max_lines arguments causes the field to be reversed before the wrap takes place. In addition, the entire paragraph is right-justified within the length indicated.
! Reverse wrap, in 30 character field. print &comment (2,35) wrap 30 5 r print $notes (1,50) wrap 50 7 r
LINE-HEIGHT specifies the number of lines to skip between each line of the wrapped data. By default a value of 1 (single space) is assumed.
The following example prints the comment column with one blank line between each printed line for a maximum of four printed lines:
print &comment (1,1) wrap 40 4 line-height = 2
LET for information on copying, editing, or converting fields
ALTER-LOCALE for a description of NUMBER-EDIT-MASK, MONEY-EDIT-MASK, and DATE-EDIT-MASK