Line commands are the primary way to perform line-level operations in the ISPF editor. They are single-character or two-character commands placed in the line number area (to the left of line numbers) that operate on specific lines or ranges of lines. This comprehensive reference covers all major line commands with detailed explanations and examples.
Understanding line commands is essential for efficient editing in ISPF. They provide a quick and intuitive way to manipulate lines without using primary commands or complex syntax. Each command has specific behavior and can often be combined or modified to perform more complex operations.
Line commands are placed in the line number area, which is the column to the left of the line numbers in the editor display.
The line command area is:
To use a line command:
After placing line commands:
The Insert command creates new blank lines in your file.
To insert a single line:
Before inserting:
123000001 This is line 1 I 000002 This is line 2 000003 This is line 3
After pressing Enter:
1234000001 This is line 1 000002 000003 This is line 2 000004 This is line 3
A blank line has been inserted above line 2, and you can now type content on the new line 2.
To insert multiple lines:
Using "I5" to insert 5 lines:
123000001 This is line 1 I5 000002 This is line 2 000003 This is line 3
After pressing Enter, 5 blank lines are inserted above line 2.
The Delete command removes lines from your file.
To delete a single line:
Before deleting:
123000001 This is line 1 D 000002 This line will be deleted 000003 This is line 3
After pressing Enter:
12000001 This is line 1 000002 This is line 3
Line 2 has been deleted, and line 3 has been renumbered to line 2.
To delete multiple lines:
To delete lines 2 through 4:
12345000001 This is line 1 D 000002 This line will be deleted 000003 This line will be deleted D 000004 This line will be deleted 000005 This is line 5
After pressing Enter, lines 2, 3, and 4 are deleted.
The Repeat command duplicates a line immediately below it.
To repeat a line:
Before repeating:
123000001 This is line 1 R 000002 This line will be repeated 000003 This is line 3
After pressing Enter:
1234000001 This is line 1 000002 This line will be repeated 000003 This line will be repeated 000004 This is line 3
Line 2 has been duplicated below it.
To repeat a line multiple times:
The Move command relocates lines from their current position to a new position.
To move lines:
Moving line 2 to after line 4:
12345000001 This is line 1 M 000002 This line will be moved 000003 This is line 3 A 000004 This is line 4 000005 This is line 5
After pressing Enter:
12345000001 This is line 1 000002 This is line 3 000003 This is line 4 000004 This line will be moved 000005 This is line 5
Line 2 has been moved to after line 4.
Moving line 3 to before line 1:
1234B 000001 This is line 1 000002 This is line 2 M 000003 This line will be moved 000004 This is line 4
After pressing Enter:
1234000001 This line will be moved 000002 This is line 1 000003 This is line 2 000004 This is line 4
Line 3 has been moved to before line 1.
To move multiple lines:
The Copy command duplicates lines at a new location while keeping the originals in place.
To copy lines:
Copying line 1 to after line 3:
1234C 000001 This line will be copied 000002 This is line 2 A 000003 This is line 3 000004 This is line 4
After pressing Enter:
12345000001 This line will be copied 000002 This is line 2 000003 This is line 3 000004 This line will be copied 000005 This is line 4
Line 1 has been copied to after line 3, and the original remains in place.
To copy multiple lines:
The After command is used with Move or Copy to place lines after a target line.
When you place "A" next to a line and have "M" commands elsewhere:
When you place "A" next to a line and have "C" commands elsewhere:
The Before command is used with Move or Copy to place lines before a target line.
When you place "B" next to a line and have "M" commands elsewhere:
When you place "B" next to a line and have "C" commands elsewhere:
The Overlay command replaces the contents of a line with the contents of another line.
To overlay a line:
Overlaying line 2 with the content of line 1:
123O 000001 This is the source line O 000002 This content will be replaced 000003 This is line 3
After pressing Enter:
123000001 This is the source line 000002 This is the source line 000003 This is line 3
Line 2's content has been replaced with line 1's content.
The Exclude command temporarily hides lines from display, useful for focusing on specific sections.
To exclude lines:
To exclude a range:
The Filter command is used to show only lines that match certain criteria, hiding others.
Filter is typically used with primary commands or search criteria to display only matching lines. The exact usage depends on your ISPF version and configuration.
Shift commands move text within a line left or right.
To shift text left:
To shift text right (note: R is also used for Repeat, context determines usage):
You can combine multiple line commands on the same screen to perform complex operations.
You can:
Inserting a line, deleting another, and moving a third:
123456000001 This is line 1 I 000002 This is line 2 D 000003 This line will be deleted M 000004 This line will be moved 000005 This is line 5 A 000006 This is line 6
After pressing Enter, all operations execute: a line is inserted above line 2, line 3 is deleted, and line 4 is moved to after line 6.
Some line commands can be modified with numbers or additional characters.
Many commands accept numbers:
Some commands use repeated characters:
Following best practices helps you use line commands effectively:
Here are some common patterns for using line commands:
Use "I5" or "I10" to insert multiple blank lines at once, useful for adding spacing or preparing for new content.
Place "M" on the first and last lines of the block, then place "A" or "B" at the target location to move entire code sections.
Place "C" on the first and last lines of the section, then place "A" or "B" at the target location to create a copy of the section.
Use "D" on multiple lines or ranges to quickly remove unwanted lines, or use "X" to temporarily hide lines you're not working on.
Think of line commands like special stickers you put on lines in your notebook:
So line commands are like special stickers that tell the editor "do something special with this line" - add a new line, erase a line, copy it, move it, or do other cool things!
Complete these exercises to reinforce your understanding of line commands:
Practice inserting and deleting lines: create a test file, use "I" to insert new lines, use "D" to delete lines, and observe how line numbers change. Practice until you can confidently insert and delete lines.
Practice using Repeat (R) to duplicate lines and Overlay (O) to replace line content. Create test scenarios where you need to duplicate content or replace it, and practice these operations.
Practice moving lines: use "M" with "A" (After) and "B" (Before) to relocate lines. Move single lines and ranges of lines, and observe how the file structure changes.
Practice copying lines: use "C" with "A" (After) and "B" (Before) to duplicate lines. Copy single lines and ranges, and verify that originals remain in place while copies are created.
Practice combining multiple line commands: perform insert, delete, move, and copy operations on the same screen. Learn how commands execute in order and how to plan complex editing operations.
1. What line command inserts a new line?
2. What is the difference between Move (M) and Copy (C)?
3. How do you delete multiple lines?
4. What does the Repeat (R) command do?
5. What does "A" (After) do when used with Move or Copy?