Page 1 of 2

Display msglines

PostPosted: Tue May 24, 2011 2:08 pm
by Julie
Hi,
my rexx program inserts msglines in a Cobol code and I want to navigate between the several message lines.
I know how to pass from a message to another using :
'isredit locate next msgline'               
if rc = 4 then 'ispexec setmsg msg(...)'

I wonder if I can return the msgline in the middle of the window (i.e. I show 5 lines of code before the msgline) rather than at the top of the window.

Re: Display msglines

PostPosted: Tue May 24, 2011 2:59 pm
by BillyBoyo
What does the manual say about setting the msgline?

Re: Display msglines

PostPosted: Tue May 24, 2011 5:24 pm
by Julie
How can I get the line numbers of all msglines inserted in the cobol code ?

Re: Display msglines

PostPosted: Tue May 24, 2011 7:03 pm
by Steve Coalbran
Hi Julie,
MSGLINEs don't have line numbers as they are not real, but "SPECIAL" lines.
I don't know of a way to FIND MSG lines unless you store the line before numbers and then you are in trouble if anyone inserts or deletes afterwards?

Re: Display msglines

PostPosted: Tue May 24, 2011 7:07 pm
by Steve Coalbran
OK - I just tried your code and it works in EDIT with a L next msgline. :D
I stand corrected (and informed!)
So why not...
ADDRESS ISREDIT
"LOCATE FIRST MSGLINE"
DO WHILE(RC=0)
   ...do something...
   "LOCATE FIRST MSGLINE"
END

Re: Display msglines

PostPosted: Tue May 24, 2011 8:01 pm
by Julie
Sorry I expressed myself badly. I know that MSGLINEs don't have line numbers. Indeed I want to get the line number of the line before .

Re: Display msglines

PostPosted: Wed May 25, 2011 12:07 pm
by Steve Coalbran
Hi Julie
When I first tried it I located on the MSG fine but getting the line returned the top line of the data.
so ... it bugged me! I had to solve it. :geek:
Here's the solution ...
-IPT- EDIT SE16661.USER.EXEC(LOCMSGS) - 01.01              Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 /*REXX*/                                                               
000002 ADDRESS ISPEXEC "CONTROL ERRORS RETURN"                                 
000003 ADDRESS ISREDIT                                                         
==MSG> message line 1                                                         
000004 "MACRO NOPROCESS"                                                       
000005 "SEEK P'=' 1 FIRST"                                                     
000006 "LOCATE FIRST MSGLINE"                                                 
==MSG> message line 2                                                         
000007 DO WHILE(RC=0)                                                         
000008    "(ML) = LINE .ZCSR"                                                 
000009    "(LN) = LINENUM .ZCSR"                                               
000010    SAY RIGHT(ln,6,0) STRIP(ml,"T")                                                 
000011    "SEEK P'=' 1 NEXT"                                                   
000012    "LOCATE NEXT MSGLINE"                                               
==MSG> message line 3                                                         
000013 END                                                                     
****** **************************** Bottom of Data ****************************

OK, this is testing on itself (which can be fatal) but in this case we're OK.
As you can see I have just pushed 3 message lines into the code to try it out, giving them the inspired names of "message line n"!
This is what I get running on Montpellier Demo under IPT (not that that should be any different to anywhere else? :? )
000004 "MACRO NOPROCESS"
000007 DO WHILE(RC=0)   
000013 END               
***                     

and end up located on the bottom line (13) on the E of END..
-IPT- EDIT SE16661.USER.EXEC(LOCMSGS) - 01.01              Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
==MSG> message line 3                                                         
000013 END                                                                     
****** **************************** Bottom of Data ****************************

Re: Display msglines

PostPosted: Wed May 25, 2011 6:51 pm
by Steve Coalbran
I tried to improve on this today and the results from it prove to be quite inconsistent.
Sometimes one gets the correct lines below the messages and sometimes just the first n data lines where n is the number of messages! Odd?
I suspect that there is some missing factor!

Re: Display msglines

PostPosted: Fri May 27, 2011 12:54 pm
by Julie
Tahnk you Steve. I'm sorry I could not reply sooner.
I'll try to change your function and see if it can work. If I succeed I'll post my solution.

Re: Display msglines

PostPosted: Fri May 27, 2011 1:10 pm
by Julie
...