ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Substring in RPG

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

  • #16
    Re: Substring in RPG

    I think I should look into the RPG cycle one more time and try to understand it. This is because when I started working on the AS400 people (who I worked with) did not encourage the use NOR did I find any existing programs which had them. Seems like I'm missing out on something here.

    Just because something's old doesnt meant its not good.

    The main thing that I like about RPG/LE and the general AS400 stuff is the ease with which the programs interact with the database tables. I have worked with multiple languages and apart from PL/SQL and/or SQL, I didnt find any other lanugage interacting with database tables as easily as RPG/LE or COBOL/400 or CL/400 does.
    Last edited by vikramx; July 8, 2011, 02:10 AM. Reason: Edit: Too many grammatical mistakes :(

    Comment


    • #17
      Re: Substring in RPG

      The one thing to note about the RPG Cycle is that it's really these days only applicable when you are reading all records from an input file (IP = Input Primary), processing them and creating output (another file or a report).

      The input can be extracted and sorted (usually done using OPNQRYF), and you have to assign an indicator to the incoming record (traditionally "01").

      To process the record, in the detail line specifications you would have:

      C 01 DO
      C ------
      C ENDDO

      I don't have any examples handy online, will see if I can dig one out and upload the key portions to help give you an example - unless anyone else wants to beat me to it.

      Using the RPG Cycle you don't have to (a) read your main input file, (b) prat around with a lot of code to check for level breaks, (c) depending on what the program is doing you can output your data/reports using the RPG Cycle too.

      The generation who tried to enforce the use of Structured Programming on RPG forgot that RPG does in fact stand for Report Program Generator, and the language was designed to help make it easier to create reports, hence the Level Break indicators etc.

      To not use these is like re-inventing the wheel, complete with pneumatic tires etc, and coming up with a wooden version like they used in ancient times.
      Poddys Rambles On

      Comment


      • #18
        Re: Substring in RPG

        An example would be great and if I can use it some instance, then I will gladly do so (provided a better alternative is unavailable).

        And yes, I do remember it standing for Report Program Generator .

        On a side note, we have cleverly side tracked what seemed to be a question on how to substring in RPG XD.

        Comment


        • #19
          Re: Substring in RPG

          Originally posted by vikramx View Post
          On a side note, we have cleverly side tracked what seemed to be a question on how to substring in RPG XD.
          You are correct. I wonder if there are threads on the RPG Cycle already. I would be surprised if there were not.
          Poddys Rambles On

          Comment


          • #20
            Re: Substring in RPG

            Originally posted by Poddys View Post
            The one thing to note about the RPG Cycle is that it's really these days only applicable when you are reading all records from an input file (IP = Input Primary), processing them and creating output (another file or a report).

            The input can be extracted and sorted (usually done using OPNQRYF), and you have to assign an indicator to the incoming record (traditionally "01").

            To process the record, in the detail line specifications you would have:

            C 01 DO
            C ------
            C ENDDO

            I don't have any examples handy online, will see if I can dig one out and upload the key portions to help give you an example - unless anyone else wants to beat me to it.

            Using the RPG Cycle you don't have to (a) read your main input file, (b) prat around with a lot of code to check for level breaks, (c) depending on what the program is doing you can output your data/reports using the RPG Cycle too.

            The generation who tried to enforce the use of Structured Programming on RPG forgot that RPG does in fact stand for Report Program Generator, and the language was designed to help make it easier to create reports, hence the Level Break indicators etc.

            To not use these is like re-inventing the wheel, complete with pneumatic tires etc, and coming up with a wooden version like they used in ancient times.
            well technically if you do not use the MAIN keyword on your H spec (and that is like v6.1 and higher) then you're "using" the cycle even if you don't think you are. *INLR if used is actually telling the RPG cycle to close all open files, etc. implicitly. so far the most part people are still using the CYCLE...just not the file processing, etc. portions
            I'm not anti-social, I just don't like people -Tommy Holden

            Comment


            • #21
              Re: Substring in RPG

              Perhaps IBM should introduce a BIF like %levelbrk(variable) instead of the RPG cycle?

              And the OPs answer is: use the BIF %subst within the IF condition like I mentioned earlier. 1 line.
              â??No bird soars too high if he soars with his own wingsâ?? â?? William Blake

              Comment

              Working...
              X