I agree with the logic that you had mentioned but the scenario here is:
I need to extract each parm and its value from PROC in two diferent REXX variable by reading each PROC line and then search the entire PROCLIB till null character to find out whether that particular symbolic parm is used before the NULL character or not. If it is used after NULL charcter, blank it out using ISPF edit macro. I am able to do the search process but finds a bug in the initial PARM extract process.
For the below PROC, we need to extract each symbolic parm (Eg: CONDB) in one REXX variable PARM1 and the corresponding value (0,NE) in second REXX variable PARM2.
The code is
PARSE VAR THEPARMS PARM1 "=" PARM2 " ', " THEPARMS
The problem with this code is that it won't extract correctly when it comes to the variable TAPERET since the above code looks for = first and store it in PARM1 and thatz fine. But after that the code looks for ', and store only spaces in PARM2 which is wrong (Even if convert that to ~, the same thing happens). The whole value ',TRTCH=COMP' should get stored in PARM2.
Note: We need this code too as it extracts the parms correctly except for TAPERET.
I am not finding any clue how to handle this. Can you plz help me in that.
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
Sorry, I did not see earlier:
Code:
PARSE VAR THEPARMS PARM1 "=" PARM2 "'," THEPARMS
should not have blanks in with your parse delimiters. (removed here). It should not have blanks unless you are searching for them. Your example with blanks should not EVER have worked.
So if I change my parm extraction code to
PARSE VAR THEPARMS PARM1 " ='~ " PARM2 " ', " THEPARMS
This code will handle my issue with TAPERET=',TRTCH=COMP',
but again I will land up in trouble when handlign some other PROC line like
// CONDV='0,NE',CONDZ='0,NE',COND4='0,NE',COND5='0,NE',
Here itz not the special char which puts up the issue but the way in which the parm was extracted.
PARSE VAR THEPARMS PARM1 "=" PARM2 " ', " THEPARMS
==> handles PROC lines 1 ,2 and 4
"ISREDIT C '7E7D6B'X '7E7DA1'X ALL"
PARSE VAR THEPARMS PARM1 " ='~ " PARM2 " '~ " THEPARMS
"ISREDIT C '7E7DA1'X '7E7D6B'X ALL"
==> Handles PROC line 3
I was just looking for a logic which handles both the scenario
Earlier, I was not able to understand the logic that you had given.
I was of the impression of changing the parm extraction step instead of handling the special character.