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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FREE FORMAT CODE OPERATOR "TAG"

Status
Not open for further replies.

rstitzel

MIS
Apr 24, 2002
286
0
0
US
I'm using RPG Free and I want to use the TAG operator.

I tried:

/free
TAG SCREEN1TAG;
/end-free

In fixed format it's
C SCREEN1TAG TAG

Please advise. Thank you!

 
TAG (and GOTO) are amongst the operation codes that are not supported in free format.

Basically you have two choices:

1. Put the offending statements outside of free format code, like:
Code:
   /end-free
  C     S1TAG         TAG
   /free
2. Rewrite the code some other way.

To see which op codes are not supported in RPG free you can check the RPG reference manual.
 
Great. I don't like to mix free format with fixed so I'll look for an alternate way to code the program. Thank you.
 
If you have any GOTOs that reference a tag on Factor 1 of an ENDSR statement, you can replace them with the Leavesr opcode.

whenever I'm working on an old program with a lot of GOTOs and TAGs, I take out a jar of tomato sauce and put it on my desk. (It's "spaghetti code").

Pass the parmesan [wink].


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
I'm rewriting old RPG II programs with a lot of goto's and tags, and indicators galore. It's very hard trying to understand these old programs and see the "big picture" on what these programs are trying to do. I'm still new to RPG and have read that goto's and tag's aren't good programming practice.

I just had to think a little harder and I was able to code my program with out the use of tags and goto's. Don't want to leave a legacy of "spaghetti code" like what's been left for me when the next person takes my place.

Thanks for the tip flapeyre.


 
Good, glad to help.


"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top