Search code examples
batch-processingzosrexxispf

How can I run ISPF Edit Macros in Batch


I frequently write and use ISPF edit macros. However, invoking them in foreground is time consuming. Can I use a Rexx program to run the edit macros against all, or a selection of, members of a PDS via batch?


Solution

  • You can use Library Management functions.

    • You use LMINIT to get a DATA ID for the dataset to be edited and then use the LMOPEN function to open the dataset.

      • You could then use LMMLIST if you want to perform the macro on a member or members of a PDS or PDSE.
    • You can then use the EDIT function specifying the macro to use/invoke, which should have an ISREDIT END or ISREDIT CANCEL.
      • If LMMLIST was used the list should be freed using LMMLIST with OPTION(FREE)
    • LMCLOSE should then be used to close the dataset.
    • LMFREE should then be used to free the DATA ID.

    The above could be done in various programming languages, although REXX would probably be the simplest.