Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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 -> CLIST & REXX
Author Message
jpdeshai

New User


Joined: 24 Jun 2007
Posts: 23
Location: Dallas

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
References
PostPosted: Sun Feb 17, 2008 1:05 am    Post subject: Re: Extract Member Name from Cursor location and Open the same Reply with quote

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 2527
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: 23
Location: Dallas

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: 2527
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: 23
Location: Dallas

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: 1117
Location: At my desk

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: 33
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1