ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Goto Tag in Free Form

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

  • #16
    Re: Goto Tag in Free Form

    Good point. I should probably create a generic shell to work from as well.

    thanks for the comp
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #17
      Re: Goto Tag in Free Form

      All in the copybooks m'lad.
      H-Specs, prototypes, etc., all in copybooks
      Regards

      Kit
      http://www.ecofitonline.com
      DeskfIT - ChangefIT - XrefIT
      ___________________________________
      There are only 3 kinds of people -
      Those that can count and those that can't.

      Comment


      • #18
        Re: Goto Tag in Free Form

        copybooks...i've heard of this, but never used it....elaborate? Link to more info?
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment


        • #19
          Re: Goto Tag in Free Form

          Originally posted by bryce4president View Post
          copybooks...i've heard of this, but never used it....elaborate? Link to more info?
          If you have stuff that's used over and over again, you put a "/COPY" statement and the code is included in the source.

          Example -- this would be the program I'm compiling.
          Code:
          * Standard definitions.
          /COPY *LIBL/QSRC,STDDFN
          Then I have another source member for my standard definitions:
          Code:
          ***************************** 
          * /COPY MEMBER FOR STANDARD BMA DEFINITIONS                                                    
          *---------------------------------------------
                                                                                                         
          * Function Key Definitions                                                                     
          D @F01            C                   x'31'                                                     
          D @F02            C                   x'32'                                                     
          D @F03            C                   x'33'                                                     
          (etc)
          
           * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                        
           * Processing Modes & Return Values                           
          D @Add            C                   'Add       '            
          D @Cancel         C                   'Cancel    '            
          D @Delete         C                   'Delete    '            
          D @Exit           C                   'Exit      '            
          D @Update         C                   'Update    '            
          D @View           C                   'View      '
          This stuff gets added to the compile much like the begin/end positions for fields with externally described files. (Or externally described data strcutures, etc)

          Additional info: http://publib.boulder.ibm.com/infoce...c092508502.htm

          Hope this helps.
          http://www.linkedin.com/in/chippermiller

          Comment


          • #20
            Re: Goto Tag in Free Form

            I call mine "Mneumonics"... but, I'm cheesy that way!

            Comment


            • #21
              Re: Goto Tag in Free Form

              Awesome. That's pretty friggin cool. I bet the guys here would see me using variables in my code and they would be like..."where is he getting these from?"

              I'll have to try to set some up the next time I'm in RPGLE

              For now, its back to JAVA
              Your future President
              Bryce

              ---------------------------------------------
              http://www.bravobryce.com

              Comment


              • #22
                Re: Goto Tag in Free Form

                what's wrong with LEAVE and ITER....you suggesting new opcodes GETOUTTATHISFRIGGINLOOP and PROCESSNEXTFRIGGINRECORD?
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment


                • #23
                  Re: Goto Tag in Free Form

                  @bryce

                  sample copybook for h-specs:
                  Code:
                  H DEBUG                                                                    
                  H Option(*srcstmt : *nodebugio)                                            
                  h dftactgrp(*no)                                                           
                  h actgrp('ECOFIT')                                                         
                  h usrprf(*owner)                                                           
                  h bnddir('CHANGEFIT')                                                      
                  Hdatfmt(*ISO)                                                              
                  Htimfmt(*HMS)                                                              
                  hcopyright ('©2006-2008 Ecofit Ltd. No part of the software or manual -    
                  hmay be reverse-engineered, reproduced, transmitted in any form -          
                  hor means, i.a. electronic, mechanical, digital, including -               
                  hphotocopying, recording, or by any information storage and retrieval -    
                  hsystem.')
                  then in the rpg:
                  Code:
                  /COPY ecocpysrc,hbndrpg
                  Regards

                  Kit
                  http://www.ecofitonline.com
                  DeskfIT - ChangefIT - XrefIT
                  ___________________________________
                  There are only 3 kinds of people -
                  Those that can count and those that can't.

                  Comment


                  • #24
                    Re: Goto Tag in Free Form

                    Originally posted by tomholden View Post
                    what's wrong with LEAVE and ITER....you suggesting new opcodes GETOUTTATHISFRIGGINLOOP and PROCESSNEXTFRIGGINRECORD?
                    No not new opcodes, just more up to date ways of thinking.

                    LEAVE and ITER statements are just GOTO statements with limited scope.

                    Anyone with a concern with structured, logical and easily maintainable coding should give them as wide a berth as possible.

                    Using well defined logic, with well named flags and variables can most often achieve a better result.
                    You don't stop playing games because you get old, You get old because you stop playing games!

                    Comment


                    • #25
                      Re: Goto Tag in Free Form

                      This post is in no way meant contradict, offend, or insult anyone, nor negate anyone's capabilities or views.

                      That said, IMHO, a lot of maintainability and or readabilty is in the eyes of the beholder. As with music, food, etc. it is a matter of personal preference.

                      From the IBM Redbook : Modernizing IBM Eserver iSeries Application Data Acess - A Roadmap Cornerstone (which is a really interesting read btw.)
                      Code:
                      Example 5-4 Calculate and display the order totals per year by using a SQL view
                      FOrdTotYr IF E DISK
                      *-----------------------------------------------------------------------------------------
                      D DspText S 50A
                      *-----------------------------------------------------------------------------------------
                      /Free
                      SetLL *Start OrdTotYr;
                      DoU %EOF(OrdTotYr);
                      Read OrdTotYrF;
                      If %EOF;
                      leave;               <------------------------------------
                      EndIf;
                      DspText = %Char(OrdYear) + ' ' + %Char(TotYear);
                      Dsply DspText;
                      EndDo;
                      Return;
                      /End-Free
                      Regards

                      Kit
                      http://www.ecofitonline.com
                      DeskfIT - ChangefIT - XrefIT
                      ___________________________________
                      There are only 3 kinds of people -
                      Those that can count and those that can't.

                      Comment


                      • #26
                        Re: Goto Tag in Free Form

                        Originally posted by kitvb1 View Post
                        This post is in no way meant contradict, offend, or insult anyone, nor negate anyone's capabilities or views.

                        That said, IMHO, a lot of maintainability and or readabilty is in the eyes of the beholder. As with music, food, etc. it is a matter of personal preference.

                        From the IBM Redbook : Modernizing IBM Eserver iSeries Application Data Acess - A Roadmap Cornerstone (which is a really interesting read btw.)
                        Code:
                        Example 5-4 Calculate and display the order totals per year by using a SQL view
                        FOrdTotYr IF E DISK
                        *-----------------------------------------------------------------------------------------
                        D DspText S 50A
                        *-----------------------------------------------------------------------------------------
                        /Free
                        SetLL *Start OrdTotYr;
                        DoU %EOF(OrdTotYr);
                        Read OrdTotYrF;
                        If %EOF;
                        leave;               <------------------------------------
                        EndIf;
                        DspText = %Char(OrdYear) + ' ' + %Char(TotYear);
                        Dsply DspText;
                        EndDo;
                        Return;
                        /End-Free
                        That worries me

                        Should have been written this way
                        Code:
                        /Free
                        SetLL *Start OrdTotYr;
                        DoU %EOF(OrdTotYr);
                        Read OrdTotYrF;
                        [B]If not %EOF[/B];
                        
                        DspText = %Char(OrdYear) + ' ' + %Char(TotYear);
                        Dsply DspText;
                        
                        [B]Endif[/B];
                        EndDo;
                        Return;
                        /End-Free
                        You don't stop playing games because you get old, You get old because you stop playing games!

                        Comment


                        • #27
                          Re: Goto Tag in Free Form

                          6 of 1 half dozen of the other
                          Your future President
                          Bryce

                          ---------------------------------------------
                          http://www.bravobryce.com

                          Comment


                          • #28
                            Re: Goto Tag in Free Form

                            i have a program I actually used the LeaveSR opcode in. Please be gentle
                            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


                            • #29
                              Re: Goto Tag in Free Form

                              Hi Mike,

                              are you using subroutines?
                              If so, avoid them! The underlying instruction to call a subroutine is nothing else than a GOTO!

                              If you are not using subroutines, you are either in a real ILE environment, where subroutines are not longer needed (bravo!), or your code looks like spaghetti!

                              Birgitta

                              Comment


                              • #30
                                Re: Goto Tag in Free Form

                                Originally posted by B.Hauser View Post
                                Hi Mike,

                                are you using subroutines?
                                If so, avoid them! The underlying instruction to call a subroutine is nothing else than a GOTO!

                                If you are not using subroutines, you are either in a real ILE environment, where subroutines are not longer needed (bravo!), or your code looks like spaghetti!

                                Birgitta
                                It wasn't my intention to rile anyones feathers on this point.

                                But my point is that RPG is an evolving language, and we should, IMHO, be making the best use of the newer functionality the language offers.

                                And I strive never to use subroutines in my code. Sub-procedures are the way to go (until something better comes along)
                                I can see the logic behind the use of the older opcodes (as in they were the only methods available at the time), and the fact that some people cant live without them.
                                You don't stop playing games because you get old, You get old because you stop playing games!

                                Comment

                                Working...
                                X