Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GOTO command in RPG

Status
Not open for further replies.

amacfantasy

Programmer
Feb 6, 2007
3
US
I was wondering if there is a GOTO command in RPG or somthing at least like it. IM looking for a way to jump from one place to another in the code.I know of Leave and ITER but they dont help me in this case and are totally different From what i want.
 
Sure is. Use command GOTO and put the tag in factor 2.

The tag uses TAG command, with tag name in factor 1.

GOTO EXIT
EXIT TAG

I don't belive this is available in free-format.
 
It's not available in free format, but, I avoid using it in any program I write (and I try to get rid of the GOTOs in any program I'm fixing). It leads to poorly structured code. It's a bad habit to get into.

It's there in fixed format only for backward compatibility, IMHO. Why else would it have been dropped from free format in the first place?

Tibi gratias agimus quod nihil fumas.

 
I cringe every time I see a goto in an RPG program...

With all the new modern RPG syntax, there is absolutely no need for a goto statement in ANY program.

Post a copy of your code & what you want to accomplish... I'm sure that someone here can help you to build a better mousetrap
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top