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

rexx Program to find the names of the paragraph which calls


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Suhas Karanth

New User


Joined: 28 Nov 2008
Posts: 4
Location: India

PostPosted: Fri Nov 28, 2008 1:32 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 28, 2008 1:40 pm
Reply with quote

show what You have written so far and somebody will be glad to help
Back to top
View user's profile Send private message
Suhas Karanth

New User


Joined: 28 Nov 2008
Posts: 4
Location: India

PostPosted: Fri Nov 28, 2008 1:48 pm
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Fri Nov 28, 2008 4:14 pm
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Fri Nov 28, 2008 4:31 pm
Reply with quote

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
View user's profile Send private message
Suhas Karanth

New User


Joined: 28 Nov 2008
Posts: 4
Location: India

PostPosted: Fri Nov 28, 2008 4:36 pm
Reply with quote

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
View user's profile Send private message
Suhas Karanth

New User


Joined: 28 Nov 2008
Posts: 4
Location: India

PostPosted: Fri Nov 28, 2008 5:02 pm
Reply with quote

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 icon_biggrin.gif
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top