Splitting and joining lines
At times, you might want to split a record in two, or join two records together. This is particularly appropriate when editing data sets that contain unstructured text (such as a REXX procedure), as in these data sets, a record represents a line of text.
To split a record in two:
- Type the SPLT primary command on the Command line.
- Position your cursor on the record that you want to split, at the column position that you want to “push” to the next line.
- Press Enter. A new record is inserted below your current record and the text from your cursor position to the end of the record is moved to the beginning of this record.
For example, when the following record is split at the cursor position (underlined character):
****** **** Top of data ****
000001 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
000002 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
the result is:
****** **** Top of data ****
000001 abcdefghijklmnopqrstuvwxyz
000002 abcdefghijklmnopqrstuvwxyz
000003 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
When you join two records, the text from the second record is combined with the first record, overlaying the first record starting at the cursor position.
To join two records together:
- Type the JOIN primary command on the Command line.
- Position your cursor on the record that you want to combine with the next record, at the column position where you want the second record text to begin.
- Press Enter. The text from the following record is combined with
the current record, overlaying any existing text.
If the text in the second record does not fit into the remaining space in the first record, it spills over into a new record.
For example, when the following records (length=50) are joined at the cursor position (underlined character):
----+----1----+----2----+----3----+----4----+----5
000000 **** Top of data ****
000001 aaaaaaaaaaaaaaaaaaaaaaaaa
000002 bbbbbbbbbbbbbbbbbbbbbbbbb
000003 cccccccccccccccccccccccccccccccccccccccccccccccccc
000004 **** End of data ****
the result is:
----+----1----+----2----+----3----+----4----+----5
000000 **** Top of data ****
000001 aaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbb
000002 cccccccccccccccccccccccccccccccccccccccccccccccccc
000003 **** End of data ****
However, if these records were joined at the same position:
----+----1----+----2----+----3----+----4----+----5
000000 **** Top of data ****
000001 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
000002 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
000003 cccccccccccccccccccccccccccccccccccccccccccccccccc
000004 **** End of data ****
the result would be:
----+----1----+----2----+----3----+----4----+----5
000000 **** Top of data ****
000001 aaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbb
000002 bbbbbbbbbbbbbbbbbbbbbbbbb
000003 cccccccccccccccccccccccccccccccccccccccccccccccccc
000004 **** End of data ****
To avoid the danger of unintentionally overlaying data in the first record, you can use the SPLTJOIN command, which can be abbreviated to SJ. This command splits or joins records depending upon the cursor position within a record. If the cursor is after the last non-blank character in a record, the command performs a join. If not, it splits the record.