Last active
June 9, 2023 19:05
-
-
Save lbdyck/049ebbfa01979f9bd7c2419c08611dbf to your computer and use it in GitHub Desktop.
SWAPEQ - ISPF Edit Macro to swap sides on an = statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* --------------- REXX ------------------ * | |
| SwapEQ - Swap the sides of an = setting | | |
| a = b | | |
| becomes | | |
| b = a | | |
* --------------------------------------- */ | |
Address ISREdit | |
"Macro (range) NOPROCESS" | |
"PROCESS RANGE S" | |
"(start) = linenum .zfrange" | |
"(stop) = linenum .zlrange" | |
do i = start to stop | |
'(data) = line' i | |
data = strip(data,'T') | |
parse value data with left'='right rest | |
leftchar = left(strip(left),1) | |
p = pos(leftchar,data) | |
if p > 1 | |
then pad = copies(' ',p-1) | |
else pad = '' | |
data = pad || right '=' strip(left) rest | |
'line' i '= (data)' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment