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
 
Adding a label to lines based on a condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Mon Mar 02, 2009 1:16 pm    Post subject: Adding a label to lines based on a condition
Reply with quote

Hi,
Is it possible to add a label to the lines of a program based on a condition?
My requirement is to display "==MSG>" when ever I encounter an error, say a DISPLAY statement in a Cobol program.
But it would be difficult to go and check the entire program for messages. So, I want to add lables to the lines where ever I encounter an error in the program, with lable name as '.ErrAA', '.ErrAB', '.ErrAC' and so on.

Is this possible to do using REXX.

Regards,
Balu
Back to top
View user's profile Send private message

Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Mon Mar 02, 2009 1:58 pm    Post subject: Reply to: Adding a label to lines based on a condition
Reply with quote

First of all, it is possible to go to MSG lines by using "LOC MSGLINE",
but I this command is not well known, and there is no shortcut (LOC MSG would be OK, but it doesn't work!).

Anyway, to set a label on cursor line, use:
Code:
MyLabel = 'AA'
Address ISREDIT 'LABEL .ZCSR = .Err'MyLabel' 0'
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Mon Mar 02, 2009 2:28 pm    Post subject:
Reply with quote

To increment the label letters, I would code:
Code:
/* One time init */
LblLst = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Lbl1 = 1
Lbl2 = 0
.
.
.
/* place label on line */
'LABEL .ZCSR = .Err'MakeLabel()' 0'

The MakeLabel function is:
Code:
MakeLabel:                                               
   Lbl2 = Lbl2 + 1                                       
   If Lbl2 > 26 Then Do                                 
      Lbl1 = Lbl1 + 1                                   
      Lbl2 = 1                                           
   End                                                   
   MyLbl = Substr(LblLst,Lbl1,1) || Substr(LblLst,Lbl2,1)
Return MyLbl

It should work from AA to ZZ!
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Mar 02, 2009 3:08 pm    Post subject:
Reply with quote

Marso wrote:
It should work from AA to ZZ!
".ZZ" labels are invalid - are not they?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Mon Mar 02, 2009 3:55 pm    Post subject:
Reply with quote

True! but it's still OK as they are prefixed
(should have said from ErrAA to ErrZZ) icon_wink.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Mar 02, 2009 4:14 pm    Post subject:
Reply with quote

oh..o o.., yup you are right... icon_smile.gif.
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Mon Mar 02, 2009 5:03 pm    Post subject:
Reply with quote

Thanks for all your effort in giving various solutions. I have your codes and they are working fine.
I just wanted to know how we can add the label to a line based on line no instead of adding to the current cursour position line.
Why because
I have coded like
Code:

NDX1 = NDX1 + 1               
'ISREDIT (KLINE) = LINE ' NDX1

to extract each line of the program and check for error in KLINE
and display a message like this:
Code:

'ISREDIT LINE_BEFORE' NDX1 '= MSGLINE' ERROR_MSG

Just similar to this I need the label in line NDX1
so, I have tried giving
Code:

ADDRESS ISREDIT 'LABEL LINE ' NDX1 ' = .ER'MYLABEL' 0'

But this is not working.
Please help me...
I have another doubt
what is use of ' 0' in the above statement?
Regards,
Balu
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Mon Mar 02, 2009 6:24 pm    Post subject: Reply to: Adding a label to lines based on a condition
Reply with quote

I have only one macro that sets labels on cursor lines,
so I had to look at the book. It says that works:
Code:
ADDRESS ISREDIT 'LABEL ' NDX1 ' = .ER'MYLABEL' 0'


The '0' is the level. It's optional. I turn again to the book:
Quote:
level The highest nesting level at which this label is visible to you or to a macro. Level 0 is the highest level. Labels at this level are visible to
you and to all levels of nested macros. Level 1 is not visible to you, but it is visible to all macros, and so on. The level can never exceed
the current nesting level. The maximum nesting level is 255. The level number defaults to the current nesting level.
Maybe one day I will have use for hidden labels. Until then I'll keep putting 0...
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Mon Mar 02, 2009 6:47 pm    Post subject:
Reply with quote

Thanks Marso! Its working!!

Regards,
Balu
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Mon Mar 02, 2009 9:10 pm    Post subject: Reply to: Adding a label to lines based on a condition
Reply with quote

My pleasure !
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

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