ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Max source width for RPGLE?

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

  • Max source width for RPGLE?

    Exactly as it sounds. What is the maximum source file width supported for RPGLE/SQLRPGLE code?
    And while we're at it, CL, DDS and SQL source?

    I'm on 7.2

  • #2
    According the CRTSRCPF command help - 32766 Bytes

    Comment


    • #3
      Do the compilers support that full size?

      Comment


      • #4
        There are two aspects to this. Will the compiler accept source this wide and second how wide can the active source portion be.
        For RPG the answer is Yes and Yes (if the first line is **Free.

        Not sure about the others.

        You can also have COBOL and RPG source in the IFS - don't think CL supports that yet but it may - I rarely use CL.

        Comment


        • #5
          CL supports IFS source in 7.4

          Comment


          • #6
            Thank you all, much appreciated. The shop I work at still uses source files with record length = 92, even for RPGLE (though I think there are one or two environments with length = 132, which is still too small for my taste).

            I'm going to float the idea of increasing the width of the QRPGLESRC source files to the bosses.
            There's no way to update a source file in situ, right? We'd have to rename the old source file, create the new one with a longer record length, and then copy all source members over?

            Comment


            • #7
              Just found this out - it looks like even with a long source member, RPGLE still does not allow code past column 80, unless you specify **free. But **free means we lose the column 1-5 area where we currently sign newly inserted lines.
              Is there a version of **free where the compiler still ignores text in columns 1-5? (I would guess not, but want to be sure).

              Comment


              • #8
                most of the kickback will be due to PDM not supporting anything more than 240 in the width for editing/viewing source code
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment


                • #9
                  There's no version of **FREE that ignores column 1-5.

                  Comment


                  • #10
                    Originally posted by tomholden View Post
                    most of the kickback will be due to PDM not supporting anything more than 240 in the width for editing/viewing source code
                    Even 240 might be too wide for comfortable editing by humans. Googling "optimum source line length" will find lots of discussions about guidelines for line length. Here's one: https://stackoverflow.com/questions/...mal-code-width

                    Me, I find it much easier to grok complex statements when they're arranged vertically rather than horizontally.

                    Code:
                    [FONT=courier new]if cust.authorize = AUTH_ALL or order(i).price * order(i).quantity > cust.max_unauthorized_price;
                      getAuthorization (order(i) : cust);
                    endif;[/FONT]
                    vs

                    Code:
                    [FONT=courier new]if cust.authorize = AUTH_ALL
                    or order(i).price  * order(i).quantity > cust.max_unauthorized_price;
                      getAuthorization (order(i)
                                      : cust);
                    endif;[/FONT]

                    Comment


                    • #11
                      ... I find 132 perfect. On a regular screen in RDI I can see 2 complete sources side by side without scrolling right or left.
                      BTW I had a customer who decided to got to 256 characters ... and is already back to 132!

                      Birgitta

                      Comment


                      • #12
                        I absolutely agree that just because a statement can be on one line, does not mean it should be. Statements like conditionals, it is much more readable to put each and/or condition on a separate line.
                        But not every statement has logical points to line break. When working with XmlTable() for instance, the long XPath expressions for every field mean a single field definition can need to be split over multiple lines, which can be quite annoying.

                        Comment


                        • #13
                          Even a fully qualified path or a qualfied data structure has logical points for breaking. That's what I do all the time
                          Birgitta

                          Comment


                          • #14
                            Originally posted by Vectorspace View Post
                            I absolutely agree that just because a statement can be on one line, does not mean it should be. Statements like conditionals, it is much more readable to put each and/or condition on a separate line.
                            But not every statement has logical points to line break. When working with XmlTable() for instance, the long XPath expressions for every field mean a single field definition can need to be split over multiple lines, which can be quite annoying.
                            Sometimes it's useful to call a procedure to handle some of the data. Say you are working with info.order(i).items(j).id, info.order(i).items(j).price etc, it's useful to pass info.order(i).items(j) to a procedure. Inside the procedure, you'd refer to item.id, item.price etc.

                            Comment

                            Working...
                            X