MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
misi01 Advanced Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Mon Aug 21, 2017 8:48 am Post subject: Can't change string containing ampersand
I have a file containing the following line
Quote:
// PARM='BMP,VNONQ81,VNONQ81,,,N00000,,1,&CKPTID,0,100,,,IMSP,,,,,,0'
My Rexx procedure looks like this
Code:
bmp_string = "PARM='BMP,"
"find '"bmp_string"' first"
do while rc = 0
rc = get_current_line()
if pos(',&',line) <> 0 then
do
/* Found what is probably a parm for the checkpoint ID.
Remove it */
parse var line first_part ',&' ckptid ',' last_part
old_str = ',&'ckptid; new_str = ','
"change '"old_str"'" "'"new_str"' .zcsr .zcsr"
end
"find '"bmp_string"' next"
end
The manual (https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.f54sg00/edit.htm ) talks about the exception caused by the first character being an ampersand. The thing is, my string is starting with a comma. When I get to the change line, I'm seeing the following
Quote:
461 *-* "change '"old_str"'" "'"new_str"' .zcsr .zcsr"
>>> "change ',&CKPTID' ',' .zcsr .zcsr"
+++ RC(4) +++
If I change the code above to the following:-
Code:
460 *-* old_str = ',='ckptid
*-* new_str = ','
461 *-* "change p'"old_str"'" "'"new_str"' .zcsr .zcsr"
>>> "change p',=CKPTID' ',' .zcsr .zcsr"
then all works well.
Can anyone suggest an explanation ? _________________ Michael
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Aug 21, 2017 11:30 am Post subject:
misi01 ,
The reason you did not find the & is because ISPF/ISREDIT evaluates/substitutes any ISPF variable.
You can avoid the scan by simply turning it off
Code:
ISREDIT "SCAN OFF"
ISREDIT "change '"old_str"'" "'"new_str"' .zcsr .zcsr"
ISREDIT "SCAN ON"
Or as you figured you can use Picture string to do the change. _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
misi01 Advanced Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Thu Aug 24, 2017 6:57 am Post subject:
Thanks Kolusu. Would never have figured that out. _________________ Michael
Back to top
misi01 Advanced Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Tue Sep 12, 2017 6:51 am Post subject: Just thought I'd append a caveat to Kolusu's suggestion
I found the following http://Mcmillan_The_Moron.com
Look for the entry appended Thu May 26, 2011 1:39 am.
Iwas trying the following thta Kolusu suggested
Code:
new_pref = '&SYSUID..'
"SCAN OFF"
"change '"old_pref"'" "'"new_pref"' .zcsr .zcsr"
"SCAN ON"
but this was failing and producing the following results (note how the first qualifier has simply "disappeared")
Code:
//SYSUT2 DD DSN=.D17105G1.BATCH(+1),
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(175,15)),
After I changed he first line above to (note the double ampersands)
Code:
new_pref = '&&SYSUID..'
then everything worked fine. _________________ Michael
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Sep 12, 2017 10:56 am Post subject:
misi01 ,
Please DO NOT ever link that moron's site. You are free to search for answers where ever you like but never link that site again. Failing to comply would result in deleting your id
Thank You
Kolusu
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum