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
 

 

Extract Member Name from Cursor location and Open the same

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

New User


Joined: 24 Jun 2007
Posts: 57
Location: US

PostPosted: Sun Feb 17, 2008 1:05 am    Post subject: Extract Member Name from Cursor location and Open the same
Reply with quote

Hi,

I have a problem in REXX.
The Requirements is:
- Open a COBOL Program
- Place the Cursor on a Copy book
- Press some key/Cmnd

Now it should extract the Coybook name at that cursor location and search the same in given PDS list and open the same for VIEW.

Can any one please help me on this?

I tried search ing for the same in the forum but could not get the exact details.

I have the sample code given bleow, but it always gives CUrsor not in place.

ISPEXEC
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISPEXEC
ADDRESS ISREDIT
"MACRO"
DSNNAME = 'TT.VI.KANBAY.ESSO.WORK.CPY'
CPYNAME = ''
"(ROS, COS) = CURSOR"
"(MEMLINE) = LINE .ZCSR"
IF(INDEX(MEMLINE,'COPY') \= 0 & INDEX(MEMLINE,'INCLUDE') \= 0) THEN
CPYNAME = WORD(MEMLINE,2)
IF(SUBSTR(MEMLINE,1,4) = '-INC') THEN
CPYNAME = WORD(MEMLINE,2)
IF(CPYNAME = '') THEN DO
SAY 'S -> CURSOR NOT IN PLACE...'
EXIT
END
ADDRESS ISPEXEC
"LMINIT DATAID(DSID) DATASET ('"DSNNAME"') ENQ(SHR)"
"VIEW DATAID("DSID") MEMBER("CPYNAME")"
"LMCLOSE DATAID("DSID")"
"LMFREE DATAID("DSID")"
"END"
EXIT

Thanks in Advance.
JP
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Feb 17, 2008 1:26 am    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

There is a flaw in Your way of doing things...
remember You are working in cobol so
a few things to take care of...

check that the current line is not a comment
extract from the line only the relevant columns ...
something like

Code:
if substr(line,7,1) \= " " then do
   setup the ispf message for the comment line
   exit
end

data = space(substr(line,8,71-8))
keyw = translate(word(data,1))
if wordpos(keywd,"COPY INCLUDE ... ....") = 0 then do
   setup the ispf message for the invalid line
   exit
end

copybook = translate(strip(word(data,2)))
....
....
Back to top
View user's profile Send private message
jpdeshai

New User


Joined: 24 Jun 2007
Posts: 57
Location: US

PostPosted: Sun Feb 17, 2008 1:38 am    Post subject:
Reply with quote

Hi Enrico,

I will be locating the cursor exactly at COPY BOOK name, like..

COPY AMBSRL...so the cursor will be at 'A'.

Can you please tell me how to do this? Am not much familier with the REXX.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Feb 17, 2008 4:48 am    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

No need to position on the the name
( if You parse the line the way I showed You in my previous post )
Code:
000027 Address ISREDIT
000028 "(LINE,CURS) = CURSOR"
000029 say "(LINE,CURS) = " line "," curs
000030 "(DATA) = LINE" line
000031 say "(DATA) = " data
000032


the code snippet will retrieve the line where the cursor is located
even if in the number area
Back to top
View user's profile Send private message
jpdeshai

New User


Joined: 24 Jun 2007
Posts: 57
Location: US

PostPosted: Sun Feb 17, 2008 5:32 am    Post subject:
Reply with quote

Thnx Enrico...
I used the same which u have given in previous post by changing a bit

It is working fine.
Back to top
View user's profile Send private message
rexxuser

New User


Joined: 07 Feb 2008
Posts: 1
Location: India

PostPosted: Tue Apr 08, 2008 12:59 am    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

Can you please give the code that you used, as my requirement is almost same as yours.

Thanks
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Apr 08, 2008 1:05 am    Post subject: Re: Reply to: Extract Member Name from Cursor location and O
Reply with quote

rexxuser wrote:
Can you please give the code that you used, as my requirement is almost same as yours.
Have you looked at and/or tried the given code?
Back to top
View user's profile Send private message
Ashwin_mudikon

New User


Joined: 03 Apr 2007
Posts: 32
Location: Chennai

PostPosted: Wed Apr 09, 2008 12:41 pm    Post subject:
Reply with quote

May I know how you are invoking this macro when pressing a key?
Back to top
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Wed Sep 16, 2009 2:30 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

Am using the code as per suggestion but some how in my code the macro ISREDIT is not working.

When I Trace the code:
3 *-* ADDRESS ISREDIT
4 *-* "(LINE,CURS) = CURSOR"
>>> "(LINE,CURS) = CURSOR"
+++ RC(20) +++
5 *-* SAY "(LINE,CURS) = " LINE "," CURS
(LINE,CURS) = LINE , CURS
6 *-* "(DATA) = LINE" LINE
>>> "(DATA) = LINE LINE"
+++ RC(20) +++
7 *-* SAY "(DATA) = " DATA
(DATA) = DATA
8 *-* EXIT 0


Please suggest me like how to use the macro ISREDIT?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Sep 16, 2009 2:32 pm    Post subject:
Reply with quote

I assume that your macro is resident in a SYSEXEC or SYSPROC defined library
Back to top
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Wed Sep 16, 2009 3:11 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

I didn't understand your response.
Like when I use the macro
ADDRESS ISREDIT
"(LINE,CURS) = CURSOR"

It thrown RC=20, what could be the reason?
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Sep 16, 2009 3:33 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

OK. Let's take a few steps backward.

Edit the dataset you want to run the macro on. Use the command TSO ISRDDN. Enter your macro name where it says "Member Name ==>" and then press enter. Do you see the PDS that your macro member name is stored in listed? If so, what DDNAME is the PDS it resides in allocated to?
Back to top
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Wed Sep 16, 2009 3:39 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

oops....Sorry If I confused.
My macro is working fine. But the in build macro ISREDIT is not working.
Because when i exeucte this macro I am facing RC=20.

When I use TRACE ON in my code:
3 *-* ADDRESS ISREDIT
4 *-* "(LINE,CURS) = CURSOR"
>>> "(LINE,CURS) = CURSOR"
+++ RC(20) +++
5 *-* SAY "(LINE,CURS) = " LINE "," CURS
(LINE,CURS) = LINE , CURS
6 *-* "(DATA) = LINE" LINE
>>> "(DATA) = LINE LINE"
+++ RC(20) +++
7 *-* SAY "(DATA) = " DATA
(DATA) = DATA
8 *-* EXIT 0

Is there any special command do I need to execute this ISREDIT ?
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed Sep 16, 2009 3:43 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

Are you missing the MACRO command? I don't see it displayed in your trace output.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Sep 16, 2009 3:46 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

the snippet I posted is not a full blown edit macro...
is just a piece of code to imbed in a running/existing macro
Back to top
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Wed Sep 16, 2009 3:50 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

I used the MACRO also in my code, but the same result.

Ref:
3 *-* ADDRESS ISREDIT
4 *-* "MACRO"
>>> "MACRO"
+++ RC(20) +++
5 *-* "(LINE,CURS) = CURSOR"
>>> "(LINE,CURS) = CURSOR"
+++ RC(20) +++
6 *-* SAY "(LINE,CURS) = " LINE "," CURS
(LINE,CURS) = LINE , CURS
7 *-* "(DATA) = LINE" LINE
>>> "(DATA) = LINE LINE"
+++ RC(20) +++
8 *-* SAY "(DATA) = " DATA
(DATA) = DATA
9 *-* EXIT 0
***

Confused, where it is going wrong to display the line and cursor details!!!
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Sep 16, 2009 7:40 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

Are you executing the macro from within the editor or from within view? Where are you executing the macro? How are you executing it?
Back to top
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Wed Sep 16, 2009 7:49 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

well !!!

I have created my rexx program and assigned to SYSEXEC
i.e. using "alloc file(sysexec) dataset('ZJ00.KO6178.REXX')"

then when I use TSO <rexx pgm name>, I am facing this error....
*-* ADDRESS ISREDIT
4 *-* "MACRO"
>>> "MACRO"
+++ RC(20) +++
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Sep 16, 2009 9:13 pm    Post subject: Reply to: Extract Member Name from Cursor location and Open
Reply with quote

Do not use TSO. TSO implies a non-editor function. Just type the name of the member in the command line.
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 What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts FTOPEN TEMP is failing due to dataset... mbenaud TSO/ISPF 7 Thu Jul 28, 2016 4:28 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts Mainframe opening for 3 to 10 yrs exp... Placementatpune Mainframe Jobs 0 Tue Jul 05, 2016 12:02 pm


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