Progress0 of 0 lessons

Command Tables and Custom Commands: Adding User Commands to ISPF

Command tables allow you to extend ISPF with custom commands that execute REXX scripts, CLISTs, display panels, or perform other operations. Understanding command tables helps you add user-defined commands to ISPF, creating a more customized and efficient environment. This tutorial covers command table structure, creating command tables, defining custom commands, and best practices.

Command tables provide a powerful way to extend ISPF functionality. By defining custom commands, you can create shortcuts, automate operations, and build integrated workflows. Learning command tables enables you to tailor ISPF to your specific needs. This tutorial provides practical guidance for command table development.

Understanding Command Tables

Command tables define custom commands for ISPF.

What are Command Tables?

Command tables are:

  • Definition files for custom commands
  • Stored in command table libraries (ISPTLIB)
  • Define command names and actions
  • Extend ISPF functionality
  • Enable user-defined commands

Command Table Libraries

Command tables are stored in:

  • Command table libraries (ISPTLIB)
  • Partitioned datasets (PDS or PDSE)
  • One command table per member
  • Libraries allocated to ISPF session

Command Table Structure

Command tables use specific syntax to define commands.

Basic Command Table

A basic command table includes:

  • Command definitions
  • Command names
  • Command actions
  • Parameters and options

Command Definition Syntax

Command definitions specify:

  • Command name
  • Action to execute
  • Parameters accepted
  • Command behavior

Example command table:

text
1
2
3
4
MYCMD REXX('USERID.REXX(MYSCRIPT)') MYCLIST CLIST('USERID.CLIST(MYCLIST)') MYPANEL PANEL(MYPANEL) MYEDIT EDIT DATASET('USERID.SOURCE.COBOL')

Creating Command Tables

Step-by-step command table creation.

Step 1: Access Command Table Library

To create a command table:

  • Use ISPF Edit
  • Open command table library (ISPTLIB)
  • Create new member
  • Or edit existing command table

Step 2: Define Commands

Write command definitions:

  • Specify command name
  • Define command action
  • Set parameters if needed
  • Configure command behavior

Step 3: Save Command Table

Save the command table:

  • Save the member
  • Verify command table syntax
  • Check for errors
  • Commands are available in ISPF

Command Types

Commands can execute different types of actions.

REXX Commands

Commands that execute REXX scripts:

text
1
2
MYREXX REXX('USERID.REXX(MYSCRIPT)') MYREXX2 REXX('USERID.REXX(SCRIPT2)') 'PARM1' 'PARM2'

REXX commands execute REXX scripts, optionally passing parameters.

CLIST Commands

Commands that execute CLISTs:

text
1
2
MYCLIST CLIST('USERID.CLIST(MYCLIST)') MYCLIST2 CLIST('USERID.CLIST(CLIST2)') 'PARM1'

CLIST commands execute CLIST procedures with optional parameters.

Panel Commands

Commands that display panels:

text
1
2
MYPANEL PANEL(MYPANEL) MYMENU PANEL(MYMENU)

Panel commands display ISPF panels.

Action Commands

Commands that perform actions:

text
1
2
MYEDIT EDIT DATASET('USERID.SOURCE.COBOL') MYBROWSE BROWSE DATASET('USERID.DATA.INPUT')

Action commands execute ISPF functions or TSO commands.

Command Parameters

Commands can accept parameters.

Defining Parameters

Parameters in command definitions:

  • Specify parameter positions
  • Define parameter types
  • Set default values
  • Validate parameters

Parameter Usage

Parameters are passed to:

  • REXX scripts (via ARG)
  • CLISTs (via PROC parameters)
  • Command actions
  • Panel variables

Using Custom Commands

Custom commands can be used in various contexts.

From Command Line

Use commands from ISPF command line:

  • Type command name
  • Add parameters if needed
  • Press Enter
  • Command executes

From Panels

Use commands from panels:

  • Define commands in panel PROC
  • Invoke commands from panel logic
  • Use commands in menu options
  • Integrate into applications

From Menus

Use commands in menus:

  • Add commands to menu options
  • Invoke commands from menu selections
  • Create custom menu flows

Command Table Examples

Examples of command table definitions.

Simple REXX Command

Command that runs a REXX script:

text
1
MYSCRIPT REXX('USERID.REXX(MYSCRIPT)')

Command with Parameters

Command that accepts parameters:

text
1
MYEDIT REXX('USERID.REXX(EDITDSN)') 'DSN'

Panel Command

Command that displays a panel:

text
1
MYMENU PANEL(MYMENU)

Action Command

Command that performs an action:

text
1
MYLIST LISTCAT ENTRIES('USERID.*')

Best Practices

Following best practices improves command table quality:

  • Use Meaningful Names: Use descriptive command names
  • Document Commands: Document command purpose and usage
  • Validate Parameters: Validate command parameters
  • Handle Errors: Provide error handling in commands
  • Test Commands: Test commands before use
  • Follow Conventions: Follow ISPF naming conventions
  • Organize Commands: Group related commands together
  • Version Control: Maintain command table versions

Explain Like I'm 5: Command Tables

Think of command tables like a custom remote control:

  • Command Tables are like programming a custom remote control. Instead of using the buttons that came with the TV, you program new buttons that do exactly what you want. You decide what each button does - maybe one button turns on the TV and changes to your favorite channel, or another button does a whole series of actions. It's like having a smart remote with custom buttons!
  • Custom Commands are like the custom buttons on your remote. Each button (command) does something specific that you programmed. You press the button (type the command), and it does the action you defined. It's like having buttons that do exactly what you need!
  • Creating Commands is like programming the remote buttons. You write down what each button should do - maybe "when I press this button, run this script" or "when I press this button, show this screen." Then you save it, and the buttons work. It's like programming your remote control!
  • Using Commands is like pressing the buttons on your remote. You type the command name (press the button), and it does what you programmed it to do. It's like using your custom remote control buttons!

So command tables are like programming a custom remote control for ISPF, where you create buttons (commands) that do exactly what you want them to do!

Practice Exercises

Complete these exercises to reinforce your command table skills:

Exercise 1: Create Simple Command

Practice basics: create a simple command that executes a REXX script, understand command table structure, test the command, and learn basic command creation. Master basic command creation.

Exercise 2: Command with Parameters

Practice parameters: create a command that accepts parameters, pass parameters to REXX script, test with different parameters, and learn parameter handling. Master command parameters.

Exercise 3: Panel Command

Practice panel: create a command that displays a panel, understand panel commands, test panel display, and learn panel commands. Master panel commands.

Exercise 4: Action Command

Practice action: create a command that performs an action, understand action commands, test action execution, and learn action commands. Master action commands.

Exercise 5: Complete Command Table

Practice complete: create a complete command table with multiple commands, organize commands, test all commands, and learn command table management. Master command table development.

Test Your Knowledge

1. Where are command tables stored?

  • ISPPLIB
  • ISPTLIB
  • ISPMLIB
  • ISPSLIB

2. What do command tables define?

  • Only panel names
  • Custom commands and their actions
  • Only REXX scripts
  • Only CLISTs

3. What can custom commands execute?

  • Only REXX scripts
  • REXX scripts, CLISTs, panels, and other actions
  • Only CLISTs
  • Only panels

4. How do you invoke custom commands?

  • Only from command line
  • From ISPF command lines, menus, or panels
  • Only from menus
  • Only from panels

5. What is ISPTLIB?

  • Panel library
  • Command table library
  • Message library
  • Skeleton library

Related Concepts