z/OS ISPF Edit and Edit Macros
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Performing repeated tasks

z/OS ISPF Edit and Edit Macros
SC19-3621-00

You can use an edit macro to save keystrokes when you frequently perform a task. A simple example would be using a macro to delete every line that begins with a dash (-) in column 1. You could scan the data and manually delete each line, or you could write a macro that does the same thing much faster. The edit macro in Figure 1 processes the commands necessary to delete the lines and requires only that you enter the ISRDASH macro.

Figure 1. ISRDASH macro
/*********************************************************************/
/*                                                                   */
/* 5647-A01 (C) COPYRIGHT IBM CORP 1995, 2003                        */
/*                                                                   */
/* ISRDASH  Delete lines with a '-' in column 1                      */
/*          except the first '-'                                     */
/*                                                                   */
/*********************************************************************/
ISREDIT MACRO
  ISREDIT RESET EXCLUDED        /* Ensure no lines are excluded  */
  ISREDIT EXCLUDE ALL '-' 1     /* Exclude lines with '-' in col1*/
  ISREDIT FIND FIRST '-' 1      /* Show the first such line      */
  ISREDIT DELETE ALL EXCLUDED   /* Delete all lines left excluded*/
EXIT CODE (0)

When you run this macro, it deletes all lines beginning with a dash, except the first one. To run the macro, type isrdash on the command line (Figure 2). The dash macro deletes all lines that began with a dash except the first one (Figure 3).

Figure 2. ISRDASH macro - before running
Screen dump.
Figure 3. ISRDASH macro - after running
Screen dump.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014