Mainframe · ISPF

IBM Sample Edit Macros

ispf edit-macros ddnames

IBM provides some sample ISPF edit macros in the SYS1.SISPSAMP library. These are useful as-is or as a basis for learning to write your own edit macros. Today we will discuss a few of them.

First of all, to use the edit macros we need to ensure that SISPSAMP is allocated. This can be done by including it in our login procedures under the SYSPROC concatenation, or with an ALLOC command. For example:

ALLOC F(SYSPROC) DA('SYS1.SISPSAMP') SHR REU

This is a TSO command, so remember to prefix it with TSO if you are entering it from an ISPF panel. Once they are allocated, edit macros are always called by entering the member name on the command line of your ISPF edit session.

ISRONLY

ONLY is an edit macro that combines the functionality of the FIND and EXCLUDE macros. It will display only the lines containing the string that you specify. Instead of doing X ALL;F <string> ALL, you can use:

ONLY <string>

ISRBOX

BOX is an edit macro that inserts a box drawn from characters into the open member you are editing. The box's top left corner will start at your cursor position. It will then reposition your cursor inside the box so you can begin to enter a note in it. It is useful for highlighting notes for yourself or other programmers.

REXX vs CLIST — and Why DDnames Matter

Something is different about these two edit macros — apart from their functionality.

If you look at the members, ISRONLY has a /* REXX */ comment declaration at the top. ISRBOX does not — this is because ISRBOX is a CLIST program. Edit macros can be written in REXX or CLIST, and you will often see a combination of both where CLIST commands are used in a REXX program.

It is important we recognize the difference between the two, because z/OS processes them differently. That is why we allocated SISPSAMP to the SYSPROC concatenation, which can handle running both REXX and CLIST statements. If we were to allocate it to another concatenation like SYSEXEC, which can only process REXX statements, the CLIST macros would return with syntax errors because they are being read as if they are REXX.

This also goes for other DDname concatenations. If you misallocate a panel to ISPMLIB, when it was supposed to be under ISPPLIB, your panels will most likely not display.

ISPF DDname Reference

The base ISPF library types are:

  • ISPMLIB — Message library
  • ISPPLIB — Panel library
  • ISPSLIB — Skeleton library
  • ISPTLIB — Table input library
  • ISPTABL — Table output library
  • ISPFILE — File tailoring output file
  • ISPLLIB — Load module library
  • ISPILIB — Image library

Likewise, TSO uses:

  • SYSPROC — TSO/E CLISTs and REXX execs
  • SYSEXEC — REXX execs only

Getting these mixed up is a common source of mysterious errors when allocating libraries. Always double-check you're allocating to the right DDname for what your library contains.