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

Extract Member Name from Cursor location and Open the same


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sun Feb 17, 2008 1:26 am
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sun Feb 17, 2008 4:48 am
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
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
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: 2146
Location: At my coffee table

PostPosted: Tue Apr 08, 2008 1:05 am
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
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Sep 16, 2009 2:32 pm
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
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

Global Moderator


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

PostPosted: Wed Sep 16, 2009 3:33 pm
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
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

Global Moderator


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

PostPosted: Wed Sep 16, 2009 3:43 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Sep 16, 2009 3:46 pm
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
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

Global Moderator


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

PostPosted: Wed Sep 16, 2009 7:40 pm
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
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

Global Moderator


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

PostPosted: Wed Sep 16, 2009 9:13 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Mainframe openings in Techmahnidra fo... Mainframe Jobs 0
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Calling an Open C library function in... CICS 1
No new posts optim extract file - SAS DB2 2
Search our Forums:

Back to Top