|
View previous topic :: View next topic
|
| Author |
Message |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi all,
I want to extract the symbolic variable and its value in 2 separate REXX variables.
In the below mentioned PROC, I want to extract the symbolic parm CONDB in one variable and the '0,NE in the other variable.
//TST0121 PROC CONDB='0,NE',CONDQ='0,NE',CONDR='0,NE',CONDT='0,NE',
// TAPERET=',TRTCH=COMP',
Note: I had handled the PROC statement and stored the line after PROC in the THPARMS variable
PARSE VAR ALINE 'PROC' THEPARMS
Below code gets the symbolic parm and its value in 2 diff variables - PARM1 and PARM2
| Code: |
| PARSE VAR THEPARMS PARM1 "=" PARM2 " ', " THEPARMS |
The problem is that the above code wont work fine for statement TAPERET=',TRTCH=COMP',
In this case TAPERET will be in PARM1 variable and spaces will be in PARM2 variable wherein it shud have value ',TRTCH=COMP
Please help in this |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
| Back to top |
|
 |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Thanks Enrico...
But If i can get the help in solving it by means of ISREDIT macro instead of exporting the JCL parser, it will be great.
Thanks
Chidam |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
|
|
| Quote: |
| But If i can get the help in solving it by means of ISREDIT macro instead of exporting the JCL parser, it will be great. |
if You change the I/O statements, the parser will become an edit macro
instead of ...
| Code: |
call lineout ..... use
Address ISREDIT LINE AFTER .ZLAST = LINE |
|
|
| Back to top |
|
 |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Thatz right...
But If anybody can help me in modifying this code to handle the above concern, that will be helpful
| Code: |
| PARSE VAR THEPARMS PARM1 "=" PARM2 " ', " THEPARMS |
|
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2622 Location: Silicon Valley
|
|
|
|
When I find constants that look like command syntax (or delimiters in this case), I temporarily change them to something else.
Your example:
| Code: |
| // TAPERET=',TRTCH=COMP', |
Use:
| Code: |
"CHANGE '7E7D6B'x '7E7DA1'x "
|
Then use your normal parsing. Be sure to change any leading A1x to 6Bx when you use the constants. |
|
| Back to top |
|
 |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Pedro,
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.
//TST0542 PROC CONDB='0,NE',CONDQ='0,NE',CONDR='0,NE',CONDT='0,NE',
// CONDV='0,NE',CONDZ='0,NE',COND4='0,NE',COND5='0,NE',
// TAPERET=',TRTCH=COMP',
// GDG='GDG,',
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. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| I am not finding any clue how to handle this. Can you plz help me in that. |
As i have posted in other topics, there is a difference between persistence and stubborn.
You have been given a solution but seem to be unwilling to even try it.
Why should you or the rest of us spend more time on this until you show why the code offered will not do what you need?
d |
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2622 Location: Silicon Valley
|
|
|
|
Start with:
| Code: |
| // TAPERET=',TRTCH=COMP', |
Change to:
| Code: |
| // TAPERET='~TRTCH=COMP', |
Parse with :
| Code: |
| PARSE VAR THEPARMS PARM1 "=" PARM2 " ', " THEPARMS |
Should result in:
| Code: |
parm1 = "TAPERET"
parm2 = "'~TRTCH=COMP" |
And as I said earlier, you need to change "~" back to "," before using the string. |
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2622 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. |
|
| Back to top |
|
 |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Hi Dsch
Sorry If i am saying something wrong. I had tried the code which was put forth. After that only I replied becaz it didn't satisfy my reqt.
For the below mentioned PROC
//TST0542 PROC CONDB='0,NE',CONDQ='0,NE',CONDR='0,NE',CONDT='0,NE',
// CONDV='0,NE',CONDZ='0,NE',COND4='0,NE',COND5='0,NE',
// TAPERET=',TRTCH=COMP',
// GDG='GDG,'
the code offered is
"ISREDIT C '7E7D6B'X '7E7DA1'X "
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 |
|
| Back to top |
|
 |
Pedro
Global Moderator

Joined: 01 Sep 2006 Posts: 2622 Location: Silicon Valley
|
|
|
|
We appended at almost the same time... please read my earlier append
===
Sorry if I was not clear. Sort of a repeat:
When I find data that looks like command syntax (or delimiters in this case), I temporarily change the data to something else.
Your example:
| Code: |
| // TAPERET=',TRTCH=COMP', |
Change your PROC file:
| Code: |
| "CHANGE '7E7D6B'x '7E7DA1'x " |
Then use your normal parsing. Be sure to change any leading A1x to 6Bx when you use the constants.
Apparently you changed your rexx program instead of the PROC dataset |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| Sorry If i am saying something wrong. I had tried the code which was put forth. After that only I replied becaz it didn't satisfy my reqt. |
Not to worry. I don't believe you mentioned that the offered code did not work for you. . .
d |
|
| Back to top |
|
 |
chidams78 Currently Banned New User
Joined: 29 May 2006 Posts: 59 Location: India
|
|
|
|
Pedro,
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.
Now I had implemented it and it works fine...:-)
Sorry for the confusion.
Thanks all.
Chidam |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|