IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to read current line via a macro


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dvpkumar217

New User


Joined: 01 Sep 2007
Posts: 11
Location: Baltimore, MD US

PostPosted: Sat Sep 01, 2007 12:52 am
Reply with quote

My requirement is to read the current line using a macro. I have written the following code, but its not working.

/*************************** REXX *************************/
"ISPEXEC CONTROL NONDISPL ENTER"
ADDRESS ISREDIT
"ISREDIT MACRO"
"ISREDIT (LINER) = LINE .ZCSR"
SAY LINER

Output: LINER
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Sep 01, 2007 1:19 am
Reply with quote

Try

"ISREDIT (CRSLINE,CRSCOL) = CURSOR"

Where CRSLINE gives the line number and CRSCOL gives the column location

Rather nicely documented in the manual
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Sep 01, 2007 1:33 am
Reply with quote

instead of this:
"ISREDIT (LINER) = LINE .ZCSR"
use this
"ISREDIT (LINER) = LINE" .ZCSR

.zcsr should not be in the quotes.
Back to top
View user's profile Send private message
dvpkumar217

New User


Joined: 01 Sep 2007
Posts: 11
Location: Baltimore, MD US

PostPosted: Sat Sep 01, 2007 1:38 am
Reply with quote

Its not working still... even after

"ISREDIT (LINER) = LINE" .ZCSR

Thanks
Pavan.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Sep 01, 2007 1:49 am
Reply with quote

What is the error message, please post what you are seeing at the point of failure
Back to top
View user's profile Send private message
dvpkumar217

New User


Joined: 01 Sep 2007
Posts: 11
Location: Baltimore, MD US

PostPosted: Sat Sep 01, 2007 1:51 am
Reply with quote

It says: LINER

Expected output: Current line in a PS.

Thanks
Pavan.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Sep 01, 2007 1:55 am
Reply with quote

Code:

/*  REXX  */
ADDRESS ISREDIT
"MACRO"
"ISREDIT(LINER) = LINE" .ZCSR
SAY LINER


and use Trace

TRACE ?R
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Sep 01, 2007 1:59 am
Reply with quote

"ISREDIT (CRSLINE,CRSCOL) = CURSOR"
"ISREDIT (LINEDATA) = LINE " CRSLINE

Has always worked for me.

Once the cursor has been positioned on a line by a F 'whatever' command, I use the above code and LINEDATA contains the line from the dataset.

The fact that your output shows 'LINER' suggests that the variable is uninitialised. Are you running batch or foreground.
Back to top
View user's profile Send private message
dvpkumar217

New User


Joined: 01 Sep 2007
Posts: 11
Location: Baltimore, MD US

PostPosted: Sat Sep 01, 2007 2:05 am
Reply with quote

Thanks for your quick response.

But I am not aware of TRACE. What is TRACE and how is it used?

My actual requirement is:

I have to display the current line (where the cursor is positioned) in a PDS member. So I will be giving the EXEC command in the command line, place the cursor at the required line in a PDS Member and hit an enter. The expected output is that line where the cursor is present.

Please let me know if there is any other better way to achieve this.

Thanks,
Pavan.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Sep 01, 2007 2:18 am
Reply with quote

OK, I am somewhat baffled by the reason for performing this task.

Dare I ask if this is a HOMEWORK or project type question. Because if it is - Please do not post these questions on the forum. We are here to help people not to do their homework for them.
Back to top
View user's profile Send private message
dvpkumar217

New User


Joined: 01 Sep 2007
Posts: 11
Location: Baltimore, MD US

PostPosted: Sat Sep 01, 2007 2:21 am
Reply with quote

I am really sorry, if I have asked you so many questions.

But, I am not sitting here to do any homework... Please help me if you know.

I am generating a tool for my company.

Thanks,
Pavan.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Sep 01, 2007 2:29 am
Reply with quote

Well, as Dick has said - run with TRACE ?R as the very first line of code after the REXX first line. Or use TRACE I for even more detail.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Sep 01, 2007 2:31 am
Reply with quote

Hello,

Quote:
What is TRACE and how is it used?


TRACE is a diagnostic aid and will show you what is going on in the code.
Back to top
View user's profile Send private message
dvpkumar217

New User


Joined: 01 Sep 2007
Posts: 11
Location: Baltimore, MD US

PostPosted: Sat Sep 01, 2007 2:42 am
Reply with quote

Thanks for the help. I could use TRACE.

But RC(20) is being returned at

"ISREDIT MACRO"

and

"ISREDIT (LINER) = LINE" .ZCSR

I am not sure why??

Thanks for your help and patience.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Sep 01, 2007 3:11 am
Reply with quote

are you in an edit or view session when executing the macro?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Sep 01, 2007 3:41 am
Reply with quote

Try

ADDRESS TSO

instead of ADDRESS ISREDIT
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
Search our Forums:

Back to Top