Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 10256
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: 1228
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: 1228
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us