How to find the If – Endif relationship

120 pts.
AS 400
Hi it is very hard to find which END is related to which IF statement. I know we can find it during compilation by using "Source listing indentation " but for this we have to check the spool file. i wanna know is there any way to find it in source. I mean i have seen thousands line of codes where the pipe symbol (|) is specified in the comment area to show the IF-EndIf relationship. I'm sure it is not done by manually. some kind of utility or compilation trick is used for that.. Could you help me to find that??

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can manually put something in the comments area or in positions 1-5 of the source. Something like b001, b002 …  e002,  e001.

Anything you do manually cannot be guarenteed accurate.

The best solution is to use Free Form RPG and indent your code.

If you have a large program and it is not Free form, another option if you are using SEU, is to use the X option on the lines. If you have not seen this before, put the cursor in the sequence number column at the left of the screen and use F1


Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    First guess -- from the menu bar select Source-> Show Indentation. A panel will open showing an "indentation view" of your source. I think it opens in a side-by-side view by default.   Second guess -- the first guess was for WDSC V5, but maybe you've modernized up to V6. The same selections will get you there. By default, I think it opens below your editor view, but you can 'Move' it up to display side by side with the editor view.   Third guess -- if you're really far behind and using an old obsolete tool like SEU, you can run a compile and then bring up the indented compiler listing to view in a split-display with your source. Running a compile will probably take less system resources than any "utility" would. If you don't like that, you can always write your own SEU exit program to show your source any way you choose. But why would anyone ask about something as old as SEU in this century?   Fourth guess -- maybe you're using a more recent RAD tool instead of old WDSC. In that case, you probably should tell us which version/release you're using.   Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: