Skip to content

Instantly share code, notes, and snippets.

@lbdyck
Created December 15, 2022 13:20
Show Gist options
  • Save lbdyck/16c6e586354523b414f87ba93a8d7b72 to your computer and use it in GitHub Desktop.
Save lbdyck/16c6e586354523b414f87ba93a8d7b72 to your computer and use it in GitHub Desktop.
DoAll - Execute an ISPF Edit Macro on All members of a PDS/PDSE
/* --------------------- rexx procedure ---------------------- *
| Name: DoAll |
| |
| Function: This rexx exec will process the specified |
| ispf edit macro against every member of the |
| specified partitioned dataset. |
| |
| Only standard system services are used. The |
| LISTD TSO command with the MEMBERS keyword |
| is used to extract the member names. |
| |
| Syntax: %DoAll dsname edit-macro |
| |
| Sample Edit Macro to change SYS1 to SYS2 |
| | rexx exec chsys1t2 (change sys1 to sys2) | |
| (the / was removed from the above line to avoid syntax |
| errors in this exec). |
| Address ISREDIT |
| "MACRO" |
| "CHANGE 'DSN=SYS1.' 'DSN=SYS2.' ALL" |
| "SAVE" |
| "END" |
| |
| Sample Execution: %Doall 'sys2.testjcl' chsys1t2 |
| |
* ------------------------------------------------------------- */
/* --------------------------------- *
| Get the target data set and macro |
* --------------------------------- */
arg dsn exec
/* ---------------------------------------- *
| Fix up data set name for use (no quotes) |
* ---------------------------------------- */
if left(dsn,1) <> "'" then do
dsn = sysvar(syspref)"."dsn
end
else do
dsn = substr(dsn,2,length(dsn)-2)
end
/* -------------------------- *
| Setup Outtrap and do ListD |
* -------------------------- */
x = outtrap("lm.","*")
"LISTD" "'"dsn"'" "MEMBERS"
x = outtrap("off")
/* ------------------- *
| Process all members |
* ------------------- */
do i = 7 to lm.0
parse value lm.i with mem extra
Address ISPEXEC "EDIT DATASET('"dsn"("mem")') MACRO("exec")"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment