ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

preferred way to putting comments

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

  • preferred way to putting comments

    Hi,

    In fixed format RPGLE programs what is the preferred way to put comments for eample in C spec either it should be either extreme left side of C spec or in comment section?



    Thanks

  • #2
    Typically put comments on their own lines indented to match the indenting of the code, like the example below although the comments. Pretty much like any other language.

    Code:
    // just for example if need a comment here
    if CarKind = *blanks;
        // Look in UMLER file
        chain CarKey trnpumlr;
        if %found(trnpumlr);
            // just for example should another comment be needed here
            CarKind = qaar;
        endif;
    endif;

    Comment


    • #3
      I never put comments in the Comment section at the right side.

      I think it's much more common to put comments on the left, above the code that the comment refers to.

      Comment


      • #4
        I should mention that I never actually write fixed form code any more. I don't know anyone who prefers to write fixed form code.

        Free-form definitions have been available for almost 10 years now, and free-form calculations have been available for about 20 years.

        Comment


        • #5
          1. So I think for C spec in fixed format RPG programming below 'hello' word should be the preferred way to add any tag or comment with respect to code line in the program is my understanding correct ?

          2. and not in the specifically designed comment section for this purpose in which I have written ' test comments' in below example ?

          3. and if my understanding is correct then why is this practise more popular whereas comment section has been designed to add comments for this only ?



          4. Also if I want to add any longer comment instead of just 'hello' ( at the extreme left side of the code line in the program) or in the comment section in the code line in the program then in this fixed format what could be done to achieve this ?



          Code:
          helloc 'hi' dsply test comments
          c eval *inlr = *on


          Thanks

          Comment


          • #6
            Sorry I didn't realize you where talking about fixed form, so silly to be doing that these days. Just put an asterisk right after the C to denote the whole line is a comment.

            Comment


            • #7
              Originally posted by John192 View Post
              Hi,

              In fixed format RPGLE programs what is the preferred way to put comments for eample in C spec either it should be either extreme left side of C spec or in comment section?



              Thanks
              Both, depending on the situation. To clarify what a field is, if I can fit it in the right hand "comment" area, then I put it there.
              For longer comments explaining following logic, I put an '*' in position 7 and write as many lines as needed to clearly explain.

              Comment


              • #8
                You can add as much text as you want at the end of the specification for fixed form specs with a specification type in column 6. The RPG compiler ignores everything after column 100 for that type of line.

                The 5-bytes at the left were originally intended for the page (2 bytes) and line number (3 bytes) for punch cards. I believe early versions of the RPG compiler actually gave a warning if those values were not numeric, and maybe it even checked that they were in the right order. Now, the compiler just ignores them, and many programmers use that area to indicate change activity.

                Comment


                • #9
                  We use the 5 bytes in position 1-5 for modification version #, that are also referenced in heading comments.

                  Comment


                  • #10
                    1. So, is there any way by which we can put arrow mark in extreme left side to refer same modification under same tag for multiple such changes ?

                    2. Is it possible to differentiate this change/modification at extreme left in a specific colour?

                    3. Is it also possible to refer these changes at extreme left in blinking colour?


                    Thanks..

                    Comment


                    • #11
                      1. When we make changes, they come from a service ticket request. If the ticket # is 1234, then we put 1234 in the header area, with date, programmer name, and description of the changes.
                      Then in pos 1-5 of the code, we put the ticket # on affected lines of code

                      2. I have seen a few cases where the whole line of code is a different color. Not sure if you can specify a color for just pos 1-5
                      3. I doubt it.

                      Comment


                      • #12
                        If you want to colour the text so it will show up differently in SEU, you need to use a separate character to turn on the colour and another one to turn it off. That would leave only 3 characters for the actual value.

                        I would hate to work on code where the change identifier was a different colour. I would really really REALLY REALLY hate to work on code where the change identifier was blinking.

                        Comment


                        • #13
                          thanks but just wanted to know how to make it possible for both on 1) PUB400.com 2) Any other IBM i server ?

                          Blinking colour at extreme left side ( at 5 bytes place) is not possible any how ?


                          Thanks..

                          Comment


                          • #14
                            Originally posted by Barbara Morris View Post
                            I would really really REALLY REALLY hate to work on code where the change identifier was blinking.
                            Same here

                            Comment


                            • #15
                              It is possible to get blinking red text in bytes 2 - 4, but it's not possible to have all 5 bytes blinking because you need one byte to set the colour and/or effect, and you need another byte to go back to normal. You can use google to find out the special values. I won't post them here because I think it's a terrible idea to have blinking text.

                              I don't think it's related to a particular server. It's related to using SEU, and it's probably also related to the emulator.

                              Comment


                              • Scott Klement
                                Scott Klement commented
                                Editing a comment
                                Yeah, they're 5250 terminal codes -- nothing specifically related to SEU.
                            Working...
                            X