Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

ISPF macro - Extracting symbolic variable and its value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
chidams78
Currently Banned

New User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Wed Sep 10, 2008 1:01 am    Post subject: ISPF macro - Extracting symbolic variable and its value
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Wed Sep 10, 2008 2:13 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

here is a pointer to a working jcl analyzer/reformatter I wrote

the I/O model is unix/linux oriented ( linein/lineout) but it works
it should take very little to port it to the EXECIO/IRSREDIT model

http://ibmmainframes.com/viewtopic.php?t=32494&highlight=linein
Back to top
View user's profile Send private message
chidams78
Currently Banned

New User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Wed Sep 10, 2008 2:39 am    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Wed Sep 10, 2008 3:41 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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
View user's profile Send private message
chidams78
Currently Banned

New User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Wed Sep 10, 2008 8:53 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2051
Location: Silicon Valley

PostPosted: Wed Sep 10, 2008 9:49 pm    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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
View user's profile Send private message
chidams78
Currently Banned

New User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2008 12:19 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 11, 2008 1:49 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2051
Location: Silicon Valley

PostPosted: Thu Sep 11, 2008 2:07 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2051
Location: Silicon Valley

PostPosted: Thu Sep 11, 2008 2:12 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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
View user's profile Send private message
chidams78
Currently Banned

New User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2008 2:12 am    Post subject:
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2051
Location: Silicon Valley

PostPosted: Thu Sep 11, 2008 2:21 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 11, 2008 2:48 am    Post subject: Reply to: ISPF macro - Extracting symbolic variable and its
Reply with quote

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. . . icon_cool.gif

d
Back to top
View user's profile Send private message
chidams78
Currently Banned

New User


Joined: 29 May 2006
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2008 8:52 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts RC 20 for Address ISPEXEC "ISRED... pkmurali CLIST & REXX 3 Sun Apr 16, 2017 11:30 pm
No new posts LISTCAT on a dataset with symbolic pa... shreya19 JCL & VSAM 5 Fri Apr 07, 2017 5:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us