Divide Command [DI]

Divides a line into two or more lines at specified columns. Divide can turn a field-oriented record into a series of lines with one field per line. It can also append a blank line after every line in a file. See also VV in Visual. For the opposite of Divide, see the Glue command.

DIVIDE [ ( columnlist ) ] [ rangelist ]

(Default: columnlist = ], rangelist = *)

The columnlist parameter is one or more valid column numbers in ascending order such as (10 20 30), or it may be a (]) for “after end-of-line” (i.e., append a blank line). All characters from the specified column to end-of-line are moved to a new line after the original line.

The rangelist parameter specifies one or more lines in the file. Each line is split into two or more lines according to the column parameter. The default rangelist is the current line.

The default columnlist is “]”, except when the Divide command has no parameters or only a “string” rangelist. Then the current line is split at the “current column”. When Divide has no parameters, the current column is “]”. Following a successful string match, the current column is the first column of the string position in the line(s).

Examples

  /find "abc";divide     {move "abc..." to a new line}  /list *+2;divide       {move ahead 2 lines, add a blank line}  /divide (20) all       {split every line at column 20}  /divide (20 40) @      {split every line at columns 20 and 40}  /divide (10 20 30)     {split current line at 3 places}  /divide (]) */*+10     {add blank line after lines */*+10}  /divide (20)"Qedit"    {split all "Qedit" lines at column 20}  /divide "Qedit"        {split all "Qedit" lines at "Qedit"}  /divide (])"Qedit"     {add blank line to all "Qedit" lines}  

Notes

After a Divide command, the current line is the last line divided. To not print the lines, use DivideQ.

Divide works within the current Left and Right margins. That is, characters to the right or left of the current margins are not moved.

When working with COBOLX files, the Divide command does not consider the tag (columns 73 to 80) as part of the data. This means that the current tag data is not moved to the new split line. It also means that you cannot divide a line passed column 73.

The QEDITCOUNT JCW is updated with the number of lines divided, rather than the number of lines resulting.

Divide Command [DI]