View previous topic :: View next topic
|
Author |
Message |
Suhas Karanth
New User
Joined: 28 Nov 2008 Posts: 4 Location: India
|
|
|
|
I am in need of rexx program which does the following.
1) If the cursor is placed at a particular line in the procedure division, and pfkey is pressed, the program should display the name of the paragraph in which the line is present.
2) After knowing the paragraph name, I want to know the names of all the paragraphs that call this paragraph. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
show what You have written so far and somebody will be glad to help |
|
Back to top |
|
|
Suhas Karanth
New User
Joined: 28 Nov 2008 Posts: 4 Location: India
|
|
|
|
ADDRESS ISPEXEC
'ISREDIT MACRO NOPROCESS'
'ISREDIT (CURLINE, CURCOL) = CURSOR' /* get current line */
IF ((CURCOL > 80) | (CURLINE = 1)) /* if first line or beyond range */
THEN DO
ZEDSMSG = 'CURSOR ERROR1';
ZEDLMSG = 'INCORRECT CURSOR POSITION!!';
'SETMSG MSG(ISRZ001)'; /* MSG WITH ALARM */
EXIT;
END;
"ISREDIT FIND ' PROCEDURE DIVISION' 7 PREV"
IF RC > 0 /* check if the cursor is on a line before the proc div*/
THEN DO
ZEDSMSG = 'CURSOR ERROR2';
ZEDLMSG = 'ERROR: THE LINE IS NOT IN THE PROCEDURE DIVISION'
'SETMSG MSG(ISRZ001)'; /* MSG WITH ERROR */
'ISREDIT CURSOR = 'CURLINE CURCOL;
EXIT
END
LINEFOUND='FALSE'
PARALINE = CURLINE
PARACOL = CURCOL
DO UNTIL LINEFOUND = 'TRUE'
'ISREDIT CURSOR = 'PARALINE PARACOL;
"ISREDIT FIND P' ^' 7 PREV" /* find paragraph name */
'ISREDIT (PARALINE, PARACOL) = CURSOR'
'ISREDIT (TLINE) = LINE' PARALINE ;
PARSE VAR TLINE ' ' PARANAME .;
IF (substr(paraname,1,4) == 'SKIP' | PARANAME == 'EJECT')
THEN /* to take into account the above keywords coded at column 8 */
NOP
ELSE
LINEFOUND='TRUE'
END
TEMPMSG = 'THIS LINE IS UNDER PARAGRAPH: ' PARANAME;
PARAMSG = PARANAME;
ZEDSMSG = PARAMSG;
ZEDLMSG = TEMPMSG;
'SETMSG MSG(ISRZ001)'; /* MSG WITH ALARM */
'ISREDIT CURSOR = 'CURLINE CURCOL;
This is a solution for the first part. But it is giving me the error "CURSOR ERROR2". For the other part i am out of ideas |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
That's strange, I got the following results:
Code: |
14 *-* "ISREDIT FIND ' PROCEDURE DIVISION' 7 PREV"
>L> "ISREDIT FIND ' PROCEDURE DIVISION' 7 PREV"
+++ RC(4) +++
16 *-* IF RC > 0 /**/ |
If I just copy and paste into the command of my edited program: FIND ' PROCEDURE DIVISION' 7 PREV and it jumps to the correct place.
If I try:
Code: |
14 *-* "ISREDIT FIND ' PROCEDURE DIVISION' PREV"
>L> "ISREDIT FIND ' PROCEDURE DIVISION' PREV"
16 *-* IF RC > 0 /**/ |
then it works correctly.
The syntax is correct. ISPF v1.7 says:
Quote: |
When you specify only one column, the editor finds the string only if the string starts in the specified column. |
I'll keep checking... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Got it:
Code: |
14 *-* "ISREDIT FIND "" PROCEDURE DIVISION"" PREV"
>L> "ISREDIT FIND " PROCEDURE DIVISION" PREV"
15 *-* 'ISREDIT (newLINE, newCOL) = CURSOR'
>L> "ISREDIT (newLINE, newCOL) = CURSOR"
16 *-* say newCOL
>V> "00001"
00001
17 *-* say newLINE
>V> "00000100"
00000100 |
It was found in column 1.
By chance, my program is defined as NUMBER DISPLAY STD COB in its profile.
Changed to NUMBER ON STD and got column 7.
Twas luck because I never use NUMBER ON COBOL (I took a program randomly).
About your program: at the beginning, query and save the USER_STATE, then issue a NONUMBER.
Then you can find your string in column 7. Before leaving, restore the USER_STATE.
If solved or if you have a question about the last part, post a message. |
|
Back to top |
|
|
Suhas Karanth
New User
Joined: 28 Nov 2008 Posts: 4 Location: India
|
|
|
|
Guys, as am new to REXX, please post the codes which u have written. that would be useful for me. Aprreciate your help. TIA |
|
Back to top |
|
|
Suhas Karanth
New User
Joined: 28 Nov 2008 Posts: 4 Location: India
|
|
|
|
Hi guys,
The first part is working now for me. i.e finding in which paragraph the statement is present.
Any inputs on how I can proceed with the second part?
Thanks for all the inputs |
|
Back to top |
|
|
|