ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Example of a Tag and Goto

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Example of a Tag and Goto

    Does anyone have a small example of how to perform a goto and a tag in free formatted RPG. I looked for some but couldn't find any. My book RPGIV free format isn't much help.

    Thanks,

    DAC

  • #2
    Re: Example of a Tag and Goto

    Okay.....There is no such animal as a goto in FREE!
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Example of a Tag and Goto

      My book "The Modern RPG IV Language" says there is a GOTO and TAG operation. Did they not bring those two over to free format?

      DAC

      Comment


      • #4
        Re: Example of a Tag and Goto

        Hi, the goto and tag are not supported in the /free version. These are 2 of the ugliest things you could use in a program. Just what are you trying to do?
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: Example of a Tag and Goto

          Im sure this is gonna start a good fight...

          There are no GOTO and TAG opcodes in FREE.

          Why in the world would you ever need a GOTO?

          They (IBM) are even trying to kill it in CL.

          Did I tell you yet today "I love you man!"?

          jamie
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #6
            Re: Example of a Tag and Goto

            GOTO?? GOTO?? I don't need no stinking GOTO!!

            Comment


            • #7
              Re: Example of a Tag and Goto

              Originally posted by jamief View Post
              Im sure this is gonna start a good fight...

              There are no GOTO and TAG opcodes in FREE.

              Why in the world would you ever need a GOTO?

              They (IBM) are even trying to kill it in CL.

              Did I tell you yet today "I love you man!"?

              jamie
              Actually, I find places where I like to use GOTO. No, you don't NEED to have it, but you don't NEED Do loops either. But we use them because they make coding easier to read and/or write.

              For example, I have a pgm with 13,000 calc lines and a dozen IF blocks. But we test in the first ten lines for a condition where we want to skip all the calcs. So I could do an IF block that is 12,990 lines long, or I could do a single GOTO EXIT command with a TAG at the end of the calcs.

              Is it better? Matter of preference, I say. Hey, sometimes I use it just to upset my peers.

              Comment


              • #8
                Re: Example of a Tag and Goto

                I know what your saying every now and again I like to slip in a
                LeaveSR opcode and If im feeling particularly evil I will put an indicator
                on an enddo and setoff in the loop... Thats good for a small laugh
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: Example of a Tag and Goto

                  Arrow, why not just use subroutines instead of having 13k in lines.
                  Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                  Comment


                  • #10
                    Re: Example of a Tag and Goto

                    Why ask why.....we are all supporting stuff written by guys like me.

                    I feel sorry for all of you

                    Easier when moding to just patch here and there rather than rewrite the
                    application to our liking.....much faster also.
                    All my answers were extracted from the "Big Dummy's Guide to the As400"
                    and I take no responsibility for any of them.

                    www.code400.com

                    Comment


                    • #11
                      Re: Example of a Tag and Goto

                      Easier when moding to just patch here and there rather than rewrite the
                      application to our liking.....much faster also.
                      I agree with the above. I'm supporting code that started out on the system 34 and was migrated through the system 36 and ended up as rpgle. I'm not going to spend the time/effort to make it current code unless there is a real requirement for enhancement.

                      IF IT AIN'T BROKE DON'T FIX IT

                      I do however do these updates as time permits (only 50 or so left).

                      GLS
                      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                      Comment


                      • #12
                        Re: Example of a Tag and Goto

                        Originally posted by DeadManWalks View Post
                        Arrow, why not just use subroutines instead of having 13k in lines.
                        I wouldn't write a pgm that big (not me!). Inherited from Mapics RPG-III. But I use this as an illustration. GOTO's earned a very bad reputation because of spaghetti code. But used (very) carefully, they can still be very useful.

                        However, its not worth enough to get me to ask IBM for it in free-format.

                        Comment


                        • #13
                          Re: Example of a Tag and Goto

                          Well it does not take much time to grab a section of code, say 4000 lines and move them to there own subroutine and insert the name of the subroutine where the code was. Rinse and repeat.

                          Why do this? because if this program has been modified that many times why not make it so the next programmer does not have to read through 13k in lines to understand where to place their one line of code.

                          If the code is always just rigged for the last change, then you are only making matters worse ( and more expensive) for the next fellow.

                          Shouldn't we leave the code better than we left it.

                          Shot me when ready.
                          Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                          Comment


                          • #14
                            Re: Example of a Tag and Goto

                            I find that it is much easier to understand GOTO and CABEQ logic when your print your source code out on Green Bar.

                            Ha ha ha ha ha ha ha
                            Predictions are usually difficult, especially about the future. ~Yogi Berra

                            Vertical Software Systems
                            VSS.biz

                            Comment


                            • #15
                              Re: Example of a Tag and Goto

                              GreenbAR Rocks! When I’m building screens now on the intranet I try to make all
                              my "subfiles" look like greenbar.......What has happened to me?

                              I cant wait till vacation time again...This year I just want to <GOTO> someplace
                              and vegetate.
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment

                              Working...
                              X