That code won't work if the search string contains an ampersand.
Here's my riff on your macro:
/* REXX */
address ISREDIT
"MACRO (sstring)"
"(mylrecl) = LRECL"
istring = copies('=',mylrecl)
"SCAN OFF"
"FIND '&SSTRING' LAST"
do while rc = 0
do 3
"LINE_BEFORE .ZCSR = (istring)"
end
"SEEK P'=' 1 .ZCSR .ZCSR FIRST"
"SEEK '&SSTRING' PREV"
end
exit
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Seymour J Metz
Sent: Monday, April 14, 2025 2:06 PM
To: [email protected]
Subject: Re: ISREDIT Macro odd request
I haven't tried it, but it looks good. It could be tightened up, but probably
not worth it.
--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר
________________________________________
From: IBM Mainframe Discussion List on behalf of Grantham, Chip
Sent: Monday, April 14, 2025 2:43 PM
To: [email protected]
Subject: Re: ISREDIT Macro odd request
External Message: Use Caution
You can try this. No guarantee:
/* REXX */
address isredit
'macro (sstring)'
'(mylrecl) = LRECL'
istring = copies('=',mylrecl)
"find '"||sstring||"' last"
"(Fcnt) = FIND_COUNTS"
Do while fcnt > 0
"(fpos) = CURSOR"
do i = 1 to 3;
"LINE_BEFORE" fpos "= (istring)"
end
fpos = fpos - 1
if fpos < 1 Then leave
"CURSOR = " fpos
"find '"||sstring||"' PREV"
"(Fcnt) = FIND_COUNTS"
End
exit
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Steely.Mark
Sent: Monday, April 14, 2025 12:54 PM
To: [email protected]
Subject: ISREDIT Macro odd request
I'm looking for an ISREDIT macro that will search for a specific string within
a member.
Whenever the string is found, the macro should insert three lines containing
only a series of =============== immediately before the matched line.
The macro should continue searching through the entire member, repeating this
action for every occurrence of the string.
If anyone has a similar EDIT macro that they could share or modify to meet this
need, I'd greatly appreciate it.
Thank You
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to
[email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN