Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
rexx Program to find the names of the paragraph which calls

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: rexx Program to find the names of the paragraph which calls
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Fri Nov 28, 2008 1:40 pm    Post subject: Reply to: rexx Program to find the names of the paragraph wh
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    Post subject: rexx program to find the names of the paragraphs which call
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: 1252
Location: Israel

PostPosted: Fri Nov 28, 2008 4:14 pm    Post subject: Reply to: rexx Program to find the names of the paragraph wh
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: 1252
Location: Israel

PostPosted: Fri Nov 28, 2008 4:31 pm    Post subject:
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    Post subject: rexx Program to find the names of the paragraph wh
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    Post subject: rexx Program to find the names of the paragraph wh
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Looping REXX - unable to interrupt RAVISANKAR07 CLIST & REXX 3 Wed Dec 06, 2017 1:08 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
This topic is locked: you cannot edit posts or make replies. Rexx to Grab ISMF Information. upendrasri All Other Mainframe Topics 16 Sun Nov 26, 2017 12:35 am
No new posts Rexx to send an email without SMTP Se... upendrasri All Other Mainframe Topics 12 Sun Nov 19, 2017 7:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us