View previous topic :: View next topic
|
Author |
Message |
Narasimha_chintu
New User
Joined: 28 Aug 2005 Posts: 3
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
Narasimha_chintu
New User
Joined: 28 Aug 2005 Posts: 3
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
John_Deal
New User
Joined: 28 Nov 2005 Posts: 4 Location: Montgomery, AL, USA
|
|
|
|
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...
|
|
Back to top |
|
|
jcbrowser
New User
Joined: 06 Oct 2005 Posts: 12
|
|
|
|
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 |
|
|
|