ISPF Edit Labels

Quoting from the IBM z/OS ISPF Edit and Edit Macros (SC19-3621-50):

A label is an alphabetic character string used to name lines or strings of data for easy reference. Because labels remain with the lines to which they are assigned, they are especially useful in keeping track of lines whose numbers might change. Most labels are assigned in macros, but certain labels are automatically assigned by the ISPF editor.

Labels provide quick access to parts of the program without having to know a record number or perform a find for a specific string.

Labels can be assigned to meaningful sections of code. For example, in a COBOL program the Identification, Environment, Data, and Program divisions could each have a label.

This is a fantastic feature of ISPF Edit provided by the ISPF developers and yet it is rarely used because of one simple reason—the labels disappear when the ISPF Edit session ends.

Here is an example of a label in a REXX program:

Restore Labels Default

As you can see – the label is .REST on record 000347, or what would be record 000347 if the label hadn’t replaced it.

To access this record while in ISPF Edit enter on the ISPF Edit command line L .REST using the period as it is an integral part of the label.

An ISPF Edit Label must start with a period and then may be followed by up to 5 letters (from A to Z) that will always be converted to upper case.

This article covers three very useful ISPF Edit commands, which are also ISPF Edit Macros, that can be used to Save, List, Import, Export, and Restore the labels. A second command is specific to REXX code and will dynamically create, and assign, ISPF Edit Labels to each REXX label. Finally, the third command is specific to Cobol and will dynamically create, and assign, ISPF Edit Labels within the Cobol code.

Note that both REXXLAB and COBLAB will enable ISPF Edit HILITE.


SAVELAB is a package found at in file 313 and at that improves upon the ISPF Edit Label features that IBM provided.

The package consists of several REXX execs, a few ISPF panels, and a sample SAVELAB Export file.

You are probably asking what benefit does SAVELAB provide? Keep reading and see the benefits, or at least some of the benefits, as I’m sure as you use this tool that you’ll discover how it improves your productivity.

Features of SAVELAB

Save and Restore

With SAVELAB all defined ISPF Edit labels can be saved so that you can easily restore them the next time you edit the data. If labels have been saved, you can easily restore them. If you set your Initial ISPF Edit Macro to SAVELAB RESTORE then the labels will be restored when you start editing, if labels exist that is.

SAVELAB SAVE will save all currently defined labels.

Note that as soon as SAVELAB is used once in the ISPF Edit session, you can abbreviate SAVELAB to SL. And as a bonus, the ISPF Edit SAVE command will be intercepted automatically, so a SAVELAB SAVE will be performed unless the ISPF Edit session is cancelled. Think of the saved labels as part of the metadata for the source code that can be shared using the EXPORT and IMPORT options (below).

You can also enable SAVELAB as your Initial ISPF Edit Macro using the ISPF Edit command IMACRO SAVELAB, and then turn it off if you ever need to by using the ISPF Edit command IMACRO NULL.


Once the labels have been created, using SAVELAB LIST, or SAVELAB SHOW, will display a selection table of all defined labels:

Active Edit Labels

As you can see, each label can be selected which will then position the Edit session on that record. The record number and the first part of the record data are also included to further help identify the label record.

Import and Export

The EXPORT option will save the label information so that you can share the labels with someone else who can then IMPORT them and begin to use the same labels. Both IMPORT and EXPORT require the specification of a dataset name (PDS/PDSE). The member name is implied by the member being edited.


Sometimes it is helpful to just see the record with the label and a few records before, and after the label. That is where HIDE comes into play.

Restore Labels

Hide takes an optional parameter specifying the number of records to display (i.e. SAVELAB HIDE 5) with a default of 3.

Command Prompting

If you forget the options available just enter SAVELAB ? to see a popup panel where a command may be entered (or use point-and-shoot):



If you ever want to see what labels you have created you can use the SAVELAB SHOW ALL, or SAVELABR SHOWALL, command. From this display you can select to  view the saved labels, use the saved labels from one member with the active member, or delete a saved set of labels. 

The saved labels are stored in an ISPF Table for safe keeping.

Saved Label Dataset

Getting Help

To learn more about SAVELAB enter SAVELAB HELP to view the Savelab ISPF Tutorial.


REXXLAB is an ISPF Edit macro that will dynamically create ISPF Edit labels. A comparable macro could be developed for other languages. Routine and Procedures have labels that start with text and end with a “:”

The label will be the 1st letter of each part of the routine or the 1st 5 characters of the routine name. If the label is 5 characters, or less, then it will be used as is. If the label with _ removed and combined is 5 characters, or less, then it will be used.



If a routine label contains characters that cannot be used in an editor label, (e.g., numbers or special characters) those characters will be translated to blanks. Existing labels will remain untouched, duplicate labels will have a suffix of A, B, C, … appended.

When used a table is displayed of all generated labels:

Active Edit Labels

And a long ISPF message with some useful information:

Labels Created


COBLAB is like REXXLAB but designed to work with COBOL source code and will dynamically create ISPF Edit labels for key COBOL constructs.

Here is a sample result of issuing the COBLAB command while in ISPF Edit:

Active Edit Labels


Anyone interested could take REXXLAB, or COBLAB, and with some, hopefully, minor alterations create a ASMLAB or CLAB or …

Contributing updates

If you wish to contribute updates, such as an ASMLAB or CLAB or xxxLAB, just go to GitHub and fork the repository. Then make your updates and generate a pull request. Standard GitHub all the way.

Lionel B. Dyck has been working with the IBM mainframe since the later half of the last century of the last millennium. He started as a JCL Clerk in 1972 and within a few years was a junior systems programmer. It was then that he began to develop tools to automate repetitive tasks that he encountered as well as those of others he supported.  Lionel is now a developer at Trident Services and continues to develop open-source tools for the mainframe community. You can find his work on the CBTTape in several files, at his website, and on Github ( where he is transitioning to from his website.

2 thoughts on “Using ISPF Edit Labels for Fun and Enhanced Productivity”

Leave a Reply

Your email address will not be published. Required fields are marked *