|
|
| Author |
Message |
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 23 Location: Dallas
|
|
|
|
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 |
|
 |
References
|
Posted: Sun Feb 17, 2008 1:05 am Post subject: Re: Extract Member Name from Cursor location and Open the same |
 |
|
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 2292 Location: italy
|
|
|
|
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 |
|
 |
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 23 Location: Dallas
|
|
|
|
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 |
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 2292 Location: italy
|
|
|
|
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 |
|
 |
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 23 Location: Dallas
|
|
|
|
Thnx Enrico...
I used the same which u have given in previous post by changing a bit
It is working fine. |
|
| Back to top |
|
 |
rexxuser
New User
Joined: 07 Feb 2008 Posts: 1 Location: India
|
|
|
|
Can you please give the code that you used, as my requirement is almost same as yours.
Thanks |
|
| Back to top |
|
 |
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 1088 Location: At my desk
|
|
|
|
| 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 |
|
 |
Ashwin_mudikon
New User
Joined: 03 Apr 2007 Posts: 33 Location: Chennai
|
|
|
|
| May I know how you are invoking this macro when pressing a key? |
|
| Back to top |
|
 |
|
|