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

Rexx Program to locate the descrepancy of IF and END-IF


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

New User


Joined: 28 Aug 2005
Posts: 3

PostPosted: Thu Sep 15, 2005 8:07 pm
Reply with quote

How do we write a rexx program to check the descrepancy of "IF" and "END-IF" ?
Eg:

IF <>
IF <>
IF <>
END-IF
END-IF
------ ( here END-IF is not present)

In the above Code, I have to locate the descrepancy of third END-IF.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Thu Sep 15, 2005 8:22 pm
Reply with quote

Hi Narasimha_chintu,
the best way that you can use is without Rexx.

This can be a method:
Enter in view mode in your program, then e(X)clude all the comment line and after this search all the "if" in your program so you will be able to view at same position all the "if", "endif" and so on.
The command to do this is this(I assume that you look in a Cobol program):
Code:
X '*' 7 ALL
DEL X ALL
X ALL
F IF ALL
DEL X ALL

if you use a separator you can do it with one or two commands:
Code:
X '*' 7 ALL;DEL X ALL
X ALL;F 'IF' ALL;DEL X ALL


I think that in Rexx, if you are trying to study the 'IF' of a cobol program, need many time time because you can also close a "if" with a point and so your search must be more complicated.

I hope in this help but if you are looking for a rexx to do this in many programs I will be here to help you more.
Back to top
View user's profile Send private message
Narasimha_chintu

New User


Joined: 28 Aug 2005
Posts: 3

PostPosted: Thu Sep 15, 2005 8:31 pm
Reply with quote

Ofcourse I want to locate in a cobol program only.
As u said I know that option for checking directly in the program.
But I want to develop a rexx tool for locating the descrepancy.
Can u please help me in this regard.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Thu Sep 15, 2005 9:40 pm
Reply with quote

Attached to this you will find a Rexx code that examin your Cobol source and show you as output this layout:
Code:
Level n.     1     IF n.     1  found on Row n.   301         
Level n.     2     IF n.     2  found on Row n.   304         
Level n.     2 END-IF n.     1  found on Row n.   307  (Point)
Level n.     1 END-IF n.     2  found on Row n.   309  (Point)
Level n.     1     IF n.     3  found on Row n.   311         
Level n.     1 END-IF n.     3  found on Row n.   312  (Point)
Level n.     1     IF n.     4  found on Row n.   318         
Level n.     1 END-IF n.     4  found on Row n.   322  (Point)
Level n.     1     IF n.     5  found on Row n.   324         
Level n.     2     IF n.     6  found on Row n.   332         
Level n.     3     IF n.     7  found on Row n.   339         
Level n.     3 END-IF n.     5  found on Row n.   343  (Point)
Level n.     2 END-IF n.     6  found on Row n.   345  (Point)
Level n.     1 END-IF n.     7  found on Row n.   347  (Point)

where:
1) Level is the nested IF
2) IF/END-IF n. is the number a progressive First IF/END, Second IF/END
3) Row n. is the row where the IF/END/POINT is found
Return Code is set to the absolute value of the difference between the number of IF and END-IF found in your program. If the match is correct Rc is 0, otherwise...

I hope in this help.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Thu Sep 15, 2005 10:09 pm
Reply with quote

Ops... I forgot something...
The jcl to submit this program is:
Code:
//*-------------------------------------------------------------------*/
//*- RUN THE SEARCHIF PROGRAM(REXX) ----------------------------------*/
//*-------------------------------------------------------------------*/
//STEP010X EXEC PGM=IKJEFT01,PARM='SEARCHIF'                           
//*---------------------------------------------------- LIBRARY OF REXX
//SYSEXEC  DD DISP=SHR,DSN=XXXXXX.XXXXXXX.XXXXXX                       
//*---------------------------------------------------- PROGRAM DD     
//INDD     DD DISP=SHR,DSN=XXXXXX.XXXXXX.XXXXXX(MYCOBOL)               
//*---------------------------------------------------- DEFAULT DD     
//SYSTSPRT DD SYSOUT=*                                                 
//SYSTSIN  DD DUMMY                                                     
//*-------------------------------------------------------------------*/
//*------------------------- END OF JOB ------------------------------*/
//*-------------------------------------------------------------------*/
Back to top
View user's profile Send private message
John_Deal

New User


Joined: 28 Nov 2005
Posts: 4
Location: Montgomery, AL, USA

PostPosted: Tue Nov 29, 2005 12:03 am
Reply with quote

Or you could try 'HILITE' on the command line (while in edit) and you can get the edit session to hilite the keywords... Then it is almost too obvious when key words are missing... icon_smile.gif
icon_cool.gif
Back to top
View user's profile Send private message
jcbrowser

New User


Joined: 06 Oct 2005
Posts: 12

PostPosted: Wed Mar 07, 2007 2:33 am
Reply with quote

Do you have the program that checks for 'IF' statements in a cobol program?

If you do can you send it to me?

Thanks,
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 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
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top