MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't change string containing ampersand

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Mon Aug 21, 2017 8:48 am    Post subject: Can't change string containing ampersand Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Mon Aug 21, 2017 11:30 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Thu Aug 24, 2017 6:57 am    Post subject: Reply with quote

Thanks Kolusu. Would never have figured that out.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Tue Sep 12, 2017 6:51 am    Post subject: Just thought I'd append a caveat to Kolusu's suggestion Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Sep 12, 2017 10:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group