Progress0 of 0 lessons

Line Commands Reference

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.

Understanding Line Commands

Line commands are placed in the line number area, which is the column to the left of the line numbers in the editor display.

Line Command Area

The line command area is:

  • Located to the left of line numbers
  • Where you type single-character or two-character commands
  • The primary interface for line-level operations
  • Visible on every line in the editor

How Line Commands Work

To use a line command:

  • Place the command character(s) in the line number area next to the target line
  • Press Enter to execute the command
  • The command operates on that line or a range of lines
  • Some commands require additional placement (like Move/Copy with After/Before)

Command Execution

After placing line commands:

  • Press Enter to execute all line commands on the screen
  • Commands are processed in order from top to bottom
  • Some commands may prompt for confirmation
  • Results are displayed immediately after execution

Insert Command (I)

The Insert command creates new blank lines in your file.

Basic Insert

To insert a single line:

  • Place "I" in the line number area next to the line where you want the new line to appear
  • The new line will be inserted above the line where you placed "I"
  • After pressing Enter, a blank line appears
  • You can then type your content on the new line

Insert Example

Before inserting:

text
1
2
3
000001 This is line 1 I 000002 This is line 2 000003 This is line 3

After pressing Enter:

text
1
2
3
4
000001 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.

Multiple Inserts

To insert multiple lines:

  • II: Inserts 2 lines
  • III: Inserts 3 lines
  • I5: Inserts 5 lines (use a number after I)
  • I10: Inserts 10 lines

Multiple Insert Example

Using "I5" to insert 5 lines:

text
1
2
3
000001 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.

Delete Command (D)

The Delete command removes lines from your file.

Basic Delete

To delete a single line:

  • Place "D" in the line number area next to the line you want to delete
  • After pressing Enter, the line is removed
  • Subsequent lines are renumbered automatically

Delete Example

Before deleting:

text
1
2
3
000001 This is line 1 D 000002 This line will be deleted 000003 This is line 3

After pressing Enter:

text
1
2
000001 This is line 1 000002 This is line 3

Line 2 has been deleted, and line 3 has been renumbered to line 2.

Multiple Deletes

To delete multiple lines:

  • DD: Deletes 2 lines starting from the current line
  • DDD: Deletes 3 lines
  • D5: Deletes 5 lines (use a number after D)
  • Range Delete: Place "D" on the first line and "D" on the last line of the range

Range Delete Example

To delete lines 2 through 4:

text
1
2
3
4
5
000001 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.

Repeat Command (R)

The Repeat command duplicates a line immediately below it.

Basic Repeat

To repeat a line:

  • Place "R" in the line number area next to the line you want to repeat
  • After pressing Enter, an exact copy of that line is inserted below it
  • The original line remains unchanged

Repeat Example

Before repeating:

text
1
2
3
000001 This is line 1 R 000002 This line will be repeated 000003 This is line 3

After pressing Enter:

text
1
2
3
4
000001 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.

Multiple Repeats

To repeat a line multiple times:

  • RR: Creates 2 copies (3 total including original)
  • RRR: Creates 3 copies (4 total including original)
  • R5: Creates 5 copies (6 total including original)

Move Command (M)

The Move command relocates lines from their current position to a new position.

Basic Move

To move lines:

  • Place "M" on the line(s) you want to move
  • Place "A" (After) or "B" (Before) next to the target line where you want the moved lines to appear
  • Press Enter to execute the move
  • The lines are removed from their original location and placed at the new location

Move After Example

Moving line 2 to after line 4:

text
1
2
3
4
5
000001 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:

text
1
2
3
4
5
000001 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.

Move Before Example

Moving line 3 to before line 1:

text
1
2
3
4
B 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:

text
1
2
3
4
000001 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.

Moving Multiple Lines

To move multiple lines:

  • Place "M" on the first line of the range
  • Place "M" on the last line of the range
  • Place "A" or "B" next to the target line
  • All lines in the range are moved together

Copy Command (C)

The Copy command duplicates lines at a new location while keeping the originals in place.

Basic Copy

To copy lines:

  • Place "C" on the line(s) you want to copy
  • Place "A" (After) or "B" (Before) next to the target line where you want the copied lines to appear
  • Press Enter to execute the copy
  • The original lines remain in place, and copies are created at the new location

Copy After Example

Copying line 1 to after line 3:

text
1
2
3
4
C 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:

text
1
2
3
4
5
000001 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.

Copying Multiple Lines

To copy multiple lines:

  • Place "C" on the first line of the range
  • Place "C" on the last line of the range
  • Place "A" or "B" next to the target line
  • All lines in the range are copied together

After Command (A)

The After command is used with Move or Copy to place lines after a target line.

Using After with Move

When you place "A" next to a line and have "M" commands elsewhere:

  • The moved lines are placed after the line marked with "A"
  • The target line remains in its position
  • Moved lines appear immediately below the target

Using After with Copy

When you place "A" next to a line and have "C" commands elsewhere:

  • The copied lines are placed after the line marked with "A"
  • Both original and copied lines remain in the file
  • Copied lines appear immediately below the target

Before Command (B)

The Before command is used with Move or Copy to place lines before a target line.

Using Before with Move

When you place "B" next to a line and have "M" commands elsewhere:

  • The moved lines are placed before the line marked with "B"
  • The target line remains in its position
  • Moved lines appear immediately above the target

Using Before with Copy

When you place "B" next to a line and have "C" commands elsewhere:

  • The copied lines are placed before the line marked with "B"
  • Both original and copied lines remain in the file
  • Copied lines appear immediately above the target

Overlay Command (O)

The Overlay command replaces the contents of a line with the contents of another line.

Basic Overlay

To overlay a line:

  • Place "O" on the source line (the line whose content you want to use)
  • Place "O" on the target line (the line whose content will be replaced)
  • Press Enter to execute the overlay
  • The target line's content is replaced with the source line's content
  • The source line remains unchanged

Overlay Example

Overlaying line 2 with the content of line 1:

text
1
2
3
O 000001 This is the source line O 000002 This content will be replaced 000003 This is line 3

After pressing Enter:

text
1
2
3
000001 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.

Exclude Command (X)

The Exclude command temporarily hides lines from display, useful for focusing on specific sections.

Basic Exclude

To exclude lines:

  • Place "X" on the line(s) you want to exclude
  • Press Enter to hide those lines
  • Excluded lines are not deleted, just hidden from view
  • You can restore excluded lines later

Excluding Multiple Lines

To exclude a range:

  • Place "X" on the first line of the range
  • Place "X" on the last line of the range
  • All lines in the range are excluded

Filter Command (F)

The Filter command is used to show only lines that match certain criteria, hiding others.

Using Filter

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 (S, L, R)

Shift commands move text within a line left or right.

Shift Left (L)

To shift text left:

  • Place "L" on the line(s) you want to shift
  • Press Enter to shift the text one position to the left
  • Use "LL" to shift two positions, "LLL" for three, etc.
  • Or use "L5" to shift 5 positions

Shift Right (R for Right Shift)

To shift text right (note: R is also used for Repeat, context determines usage):

  • Some ISPF versions use "S" for shift right
  • Place the shift command on the line(s) you want to shift
  • Press Enter to shift the text
  • Use multiple characters or numbers for multiple positions

Combining Line Commands

You can combine multiple line commands on the same screen to perform complex operations.

Multiple Operations

You can:

  • Place multiple different commands on different lines
  • Execute all commands with a single Enter
  • Commands are processed from top to bottom
  • Be careful with order when commands affect line numbers

Combined Example

Inserting a line, deleting another, and moving a third:

text
1
2
3
4
5
6
000001 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.

Line Command Modifiers

Some line commands can be modified with numbers or additional characters.

Number Modifiers

Many commands accept numbers:

  • I5: Insert 5 lines
  • D5: Delete 5 lines
  • R5: Repeat 5 times
  • L5: Shift left 5 positions

Multiple Character Modifiers

Some commands use repeated characters:

  • II: Insert 2 lines
  • DD: Delete 2 lines
  • RR: Repeat 2 times
  • LL: Shift left 2 positions

Best Practices for Line Commands

Following best practices helps you use line commands effectively:

  • Verify Before Execute: Review your line commands before pressing Enter
  • Use Ranges Carefully: When using ranges, ensure you mark the correct first and last lines
  • Understand Order: Commands execute top to bottom; be aware of how this affects line numbers
  • Test Complex Operations: For complex combinations, test on a copy first
  • Use Undo When Available: Some ISPF versions support undo; use it if you make mistakes
  • Save Frequently: Save your work before performing large operations
  • Learn Shortcuts: Master the most common commands (I, D, M, C) for efficiency
  • Combine Wisely: Combine commands when it makes sense, but avoid overly complex combinations

Common Line Command Patterns

Here are some common patterns for using line commands:

Inserting Multiple Blank Lines

Use "I5" or "I10" to insert multiple blank lines at once, useful for adding spacing or preparing for new content.

Moving a Block of Code

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.

Duplicating a Section

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.

Cleaning Up Lines

Use "D" on multiple lines or ranges to quickly remove unwanted lines, or use "X" to temporarily hide lines you're not working on.

Explain Like I'm 5: Line Commands

Think of line commands like special stickers you put on lines in your notebook:

  • I (Insert) is like a "new line" sticker. When you put an "I" sticker on a line, it says "add a new blank line here!" So a new empty line appears above that line, and you can write on it.
  • D (Delete) is like an "eraser" sticker. When you put a "D" sticker on a line, it says "erase this line!" So that line disappears, and all the lines below it move up.
  • R (Repeat) is like a "copy" sticker. When you put an "R" sticker on a line, it says "make a copy of this line right below it!" So the same line appears twice.
  • M (Move) is like a "move" sticker with an arrow. You put "M" stickers on lines you want to move, then put an "A" (After) or "B" (Before) sticker where you want them to go. It's like picking up those lines and putting them in a new place!
  • C (Copy) is like a "duplicate" sticker. You put "C" stickers on lines you want to copy, then put an "A" or "B" sticker where you want the copies. The original lines stay where they are, and new copies appear at the new place!

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!

Practice Exercises

Complete these exercises to reinforce your understanding of line commands:

Exercise 1: Basic Insert and Delete

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.

Exercise 2: Repeat and Overlay

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.

Exercise 3: Move 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.

Exercise 4: Copy Operations

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.

Exercise 5: Complex Combinations

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.

Test Your Knowledge

1. What line command inserts a new line?

  • D
  • I
  • R
  • M

2. What is the difference between Move (M) and Copy (C)?

  • Move duplicates, Copy relocates
  • Move relocates, Copy duplicates
  • They are identical
  • Move is faster

3. How do you delete multiple lines?

  • Use DD for two lines
  • Use D5 for five lines
  • Place D on first and last line of range
  • All of the above

4. What does the Repeat (R) command do?

  • Deletes a line
  • Duplicates a line below it
  • Moves a line
  • Copies a line

5. What does "A" (After) do when used with Move or Copy?

  • Places lines before the target
  • Places lines after the target
  • Deletes lines
  • Repeats lines

Related Concepts