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 locate the descrepancy of IF and END-IF

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Rexx Program to locate the descrepancy of IF and END-IF
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    Post subject:
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    Post subject: Re: Rexx Program to locate the descrepancy of IF and END-IF
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: Rexx Program to locate the descrepancy of IF and END-IF
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    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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm

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