Primary Commands vs Line Commands vs Edit-Line Commands
ISPF provides three types of commands for editing: primary commands, line commands, and edit-line commands. Understanding the differences between these command types and when to use each is essential for efficient ISPF editing. This tutorial explains each command type, where they're used, and when to choose one over the others.
Each command type serves different purposes and operates at different levels. Primary commands work on the entire file or large sections, line commands work on specific individual lines, and edit-line commands provide flexible line-level operations with command syntax. Knowing which type to use for different tasks makes editing more efficient and intuitive.
Primary Commands
Primary commands are entered on the command line and operate on the entire file or large sections of the file. They're the most powerful commands for file-wide operations.
What Are Primary Commands?
Primary commands are full command names entered on the command line (typically labeled "Command >>" at the top or bottom of the editor screen). They perform operations that affect the entire file or large portions of it.
Where to Enter Primary Commands
Primary commands are entered on the command line:
Locate the command line, usually at the top or bottom of the editor screen
The command line is typically labeled "Command >>" or similar
Type the command name and any parameters
Press Enter to execute the command
Common Primary Commands
Common primary commands include:
FIND: Searches for text in the file
CHANGE: Replaces text throughout the file
SAVE: Saves all changes to the file
CANCEL: Discards all changes and exits
COPY: Copies blocks of lines
MOVE: Moves blocks of lines
BOUNDS: Sets column boundaries
RESET: Resets the edit session
Primary Command Examples
Here are examples of primary commands:
text
1
2
3
4
5
6
7
Command ===> FIND 'SEARCHTEXT'
Command ===> CHANGE 'OLD' 'NEW' ALL
Command ===> SAVE
Command ===> CANCEL
When to Use Primary Commands
Use primary commands when:
You need to operate on the entire file (like SAVE or CANCEL)
You're performing file-wide searches or replacements (FIND, CHANGE)
You're working with large blocks of lines (COPY, MOVE)
You need commands with complex parameters or options
You're performing operations that affect the entire editing session
Line Commands
Line commands are single-character commands placed in the line number area that operate on specific individual lines. They provide quick, precise control over individual lines.
What Are Line Commands?
Line commands are single-character commands (like I, D, R, M, C) that you place in the line number area (the leftmost column, to the left of the line numbers). They perform operations on the specific line where you place them.
Where to Enter Line Commands
Line commands are entered in the line number area:
Locate the line number area, which is the leftmost column of the editor display
This area is to the left of the line numbers
Place a single-character command in this area next to the line you want to operate on
Press Enter to execute the command
Common Line Commands
Common line commands include:
I: Insert a new line after this line
D: Delete this line
R: Repeat (copy) this line
M: Move this line to another location
C: Copy this line to another location
A: After (insert after this line)
B: Before (insert before this line)
O: Overlay (replace) this line
Line Command Examples
Here's how line commands appear:
text
1
2
3
4
5
000001 This is line 1
I 000002 This is line 2
000003 This is line 3
D 000004 This line will be deleted
000005 This is line 5
In this example, "I" in the line number area will insert a line after line 2, and "D" will delete line 4.
When to Use Line Commands
Use line commands when:
You need to operate on specific individual lines
You're making precise, line-by-line edits
You need quick, single-character commands for common operations
You're inserting, deleting, or modifying specific lines
You want visual indication of which lines will be affected
You're working with a small number of lines
Edit-Line Commands
Edit-line commands combine aspects of line commands and primary commands, allowing you to perform operations on specific lines using command syntax.
What Are Edit-Line Commands?
Edit-line commands are commands that can be entered on specific lines in the editor, typically in a special command area associated with each line. They provide more flexibility than simple line commands for complex line operations.
Where to Enter Edit-Line Commands
Edit-line commands are typically entered:
In a command area associated with a specific line
Sometimes in the line number area with extended syntax
In special command fields that appear for line operations
The exact location depends on the ISPF version and configuration
Edit-Line Command Characteristics
Edit-line commands:
Operate on specific lines (like line commands)
Use command syntax (like primary commands)
Provide more flexibility than single-character line commands
Allow complex operations on individual lines
May support parameters and options
When to Use Edit-Line Commands
Use edit-line commands when:
You need line-specific operations with command syntax
Simple line commands aren't sufficient for your needs
You need parameters or options for line operations
You're performing complex operations on specific lines
You want the flexibility of commands with line-level precision
Comparing Command Types
Understanding the differences helps you choose the right command type for each task.
Scope of Operation
Command types differ in scope:
Primary Commands: Operate on the entire file or large sections
Line Commands: Operate on specific individual lines
Edit-Line Commands: Operate on specific lines with command flexibility
Command Syntax
Command types differ in syntax:
Primary Commands: Full command names with parameters (e.g., "FIND 'text'")
Line Commands: Single characters (e.g., "I", "D", "R")
Edit-Line Commands: Command syntax for line operations
Entry Location
Command types are entered in different locations:
Primary Commands: Command line (top or bottom of screen)
Line Commands: Line number area (leftmost column)
Edit-Line Commands: Line-specific command areas
Use Cases
Each command type is best for different tasks:
Primary Commands: File-wide operations, searches, saves, global changes
Line Commands: Quick line edits, insertions, deletions, simple line operations
Edit-Line Commands: Complex line operations requiring command syntax
Choosing the Right Command Type
Choosing the right command type depends on what you're trying to accomplish.
Decision Guidelines
Use this decision process:
File-wide operation? → Use a primary command
Simple line operation? → Use a line command
Complex line operation? → Consider an edit-line command
Need parameters? → Use a primary command or edit-line command
Quick single-line edit? → Use a line command
Examples of Choosing
Here are examples of choosing the right command type:
Save all changes → Primary command SAVE (affects entire file)
Delete one line → Line command D (simple line operation)
Find text in file → Primary command FIND (file-wide search)
Insert a line → Line command I (simple line operation)
Change text globally → Primary command CHANGE (file-wide operation)
Move a line → Line command M (simple line operation)
Using Commands Together
You can and should use different command types together in the same editing session.
Combining Command Types
Common combinations include:
Use line commands to make specific line edits, then use primary command SAVE to save all changes
Use primary command FIND to locate text, then use line commands to edit the found lines
Use line commands for precise edits, then use primary commands for file-wide operations
Use primary commands to set up the editor (BOUNDS), then use line commands for editing
Workflow Examples
Example workflow combining command types:
1. Use primary command FIND to locate text
2. Use line command D to delete the line containing the text
3. Use line command I to insert a new line
4. Use primary command SAVE to save all changes
Best Practices
Following best practices helps you use commands effectively:
Use Line Commands for Precision: Use line commands when you need to operate on specific lines
Use Primary Commands for Scope: Use primary commands when you need file-wide operations
Combine Effectively: Use different command types together to accomplish complex tasks
Learn Standard Commands: Learn the standard commands for each type so you can use them efficiently
Check Command Line: Always check the command line location on your system
Verify Line Number Area: Understand where the line number area is located
Practice Both Types: Practice using both primary and line commands to become comfortable with each
Explain Like I'm 5: Command Types
Think of ISPF commands like different tools for working with a document:
Primary Commands are like big tools that work on the whole document at once. Like a "Save Everything" button or a "Find All" tool that searches the whole document. You use them when you want to do something to the entire document.
Line Commands are like tiny, precise tools that work on just one line at a time. Like a tiny eraser that only erases one line, or a tiny pencil that only writes on one line. You use them when you want to change just one specific line.
Edit-Line Commands are like medium tools that work on one line but can do more complicated things. Like a tool that can do special things to one line, but with more options than the simple line tools.
So primary commands are for big jobs on the whole file, line commands are for tiny jobs on one line, and edit-line commands are for medium jobs on one line with more options!
Practice Exercises
Complete these exercises to reinforce your understanding of command types:
Exercise 1: Command Type Identification
As you use the ISPF editor, identify which type of command you're using for each operation. When you use a command, determine whether it's a primary command, line command, or edit-line command. Document your observations and build understanding of when each type is used.
Exercise 2: Primary Command Practice
Practice using primary commands: SAVE, CANCEL, FIND, CHANGE, and others. Enter them on the command line and observe their effects. Practice using parameters with primary commands. Become comfortable with primary command syntax and usage.
Exercise 3: Line Command Practice
Practice using line commands: I, D, R, M, C, and others. Place them in the line number area and observe their effects. Practice using line commands on different lines. Become comfortable with line command placement and execution.
Exercise 4: Command Combination
Practice combining command types in workflows. Use primary commands to set up operations, then use line commands for specific edits, then use primary commands to save. Create workflows that effectively combine different command types.
Exercise 5: Command Selection
For various editing tasks, determine which command type is most appropriate. Consider tasks like: deleting one line, saving all changes, finding text, inserting a line, changing text globally, moving a block of lines. Practice selecting the right command type for each task.
Test Your Knowledge
1. Where are primary commands entered in ISPF?
In the line number area
On the command line
In the data area
In the action bar
2. Where are line commands entered in ISPF?
On the command line
In the line number area
In the data area
In the action bar
3. What type of command operates on the entire file?
Line commands
Primary commands
Edit-line commands
Function keys
4. What type of command operates on specific lines?
Primary commands
Line commands
Function keys
Action bar options
5. Which command would you use to save all changes to a file?