CHR_LINBR

Break a line of text into a sequence of shorter lines

Description:

Break a long line of text into a sequence of shorter lines, making the breaks between words at spaces if possible. The maximum length of an output line is determined by the size of the character variable supplied to contain it. This routine should be called repeatedly to generate successive output lines from a single long input line. Initially, the context argument IPOSN should be set to zero; it will be updated after each call, ready to generate the next output line. A value of zero is returned for IPOSN when there are no more output lines. Any unprintable characters (e.g. tabs) are treated as if they were blanks for the purpose of identifying line-breaks.

Invocation

CALL CHR_LINBR( STR1, IPOSN, STR2 )

Arguments

STR1 = CHARACTER ( ) (Given)
The line of text to be broken into shorter lines. Leading blanks are ignored.
IPOSN = INTEGER (Given and Returned)
On entry, this argument specifies the character position in STR1 from which to start generating the next returned line. If a value less than 1 is given, then 1 will be used.

On exit, this argument is set to one more than the position in STR1 of the last non-blank character which appears in the returned line STR2 (i.e. the position at which generation of the next returned line should begin). If STR2 is blank because there are no more characters to process, then IPOSN is returned set to zero.

STR2 = CHARACTER ( ) (Returned)
The returned line, left justified. The length of this argument determines the maximum length of the returned line.