View previous topic :: View next topic
|
Author |
Message |
jpdeshai
New User
Joined: 24 Jun 2007 Posts: 57 Location: US
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 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: 57 Location: US
|
|
|
|
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
Superior Member
Joined: 14 Mar 2007 Posts: 10873 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: 57 Location: US
|
|
|
|
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: 2146 Location: At my coffee table
|
|
|
|
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: 32 Location: Chennai
|
|
|
|
May I know how you are invoking this macro when pressing a key? |
|
Back to top |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I assume that your macro is resident in a SYSEXEC or SYSPROC defined library |
|
Back to top |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Are you missing the MACRO command? I don't see it displayed in your trace output. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Do not use TSO. TSO implies a non-editor function. Just type the name of the member in the command line. |
|
Back to top |
|
|
|