ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

To know the no. of commented line in program

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

  • To know the no. of commented line in program

    My dear friends ..
    In front of us have challenging question...
    that is :-

    To know the no. of commented line in program, how many unommented and total no of line are ther in program..

    Please try to give me the hint....
    thanking you

  • #2
    Re: To know the no. of commented line in program

    well i'm not sure how to do this with the system, but there is always the manual counting method
    Your future President
    Bryce

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

    Comment


    • #3
      Re: To know the no. of commented line in program

      Read the source file with RPG. Check column 6 for an "*" or check for //. Count this as comments. Everything else is probably code.

      Comment


      • #4
        Re: To know the no. of commented line in program

        Now this sounds like the management im glad i dont work for.

        Write a program override to the source member;

        a quick and dirty way is for example;
        PHP Code:
        OVRDBF FILE(EDISRCTOFILE(EDISRCMBR(EDI000001
        PHP Code:
        select count(srcdta)           
        from edisrc                    
        where substr
        (srcdta,7,1) = '*' 
          
        or  substr(srcdta,8,2) = '//' 
        This give you this;

        PHP Code:
               //  
               //--
             
        H**   
               
        //--
               // i
        OFS    // F
        4S     // F
        4S     //FC 
        But the probelm is with free form (and if you company is not using this, tell your manager to care about this not how many lines are what ever) is that you can have comments starting at positions other then 8;
        PHP Code:
         Select;             
             
        // Exit Program 
             
        When Exit;      
                 Exit = *
        Off;
                 
        Leave

        But i ask you what is a comment?

        Are both of these lines a comment?
        PHP Code:
          //------------------------------------------
          // define message Parms for status messages. 
        Also you can have comments in position 81 as in ;
        PHP Code:
        ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+..
        SRCDTA                                                                                 
        OFS  C     KeyCust       Chain     CbCust                                       Comment 
        The rest is up to u.

        If ya make something slick, post and share pls.

        DMW
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: To know the no. of commented line in program

          Now wait a minute! Last time I checked I thought a compile listing showed all that information at the bottom!? Why are we writeing programs to do what IBM has already done for us!? Or am I missing something?

          Confused,
          MdnghtPgmr
          "Tis better to be thought a fool then to open one's mouth and remove all doubt." - Benjamin Franklin

          Comment


          • #6
            Re: To know the no. of commented line in program

            If you look at the bottom of a compile listikng, you will get a table like this.

            Source Totals:
            Records . . . . . . . . . . . . : 563
            Specifications . . . . . . . . : 425
            Data records . . . . . . . . . : 71
            Comments . . . . . . . . . . . : 32


            Records = total of next 3 lines.
            Data records = compile time table records, minus the ** lines
            Comments = any line with * in posiition 6 or starting with //
            Specifications = program lines + any lines copied in from, for example, /copy or externally defined files

            Ther CRTBNDRPG and CRTRPGMOD compiler commands give an option to not include the external files specifications - the default is to include.


            John McKay
            jmckay@mckaysoftware.ie
            We offer website development and custom software on AS400. We also create spreadsheets.
            John McKay
            jmckay@mckaysoftware.ie
            http://www.rpglanguage.com

            Comment


            • #7
              Re: To know the no. of commented line in program

              really? IBM is so nice. Those guys are swell. Now I don't have to count them manually anymore
              Your future President
              Bryce

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

              Comment


              • #8
                Re: To know the no. of commented line in program

                This smells like a school quiz.....
                Bill
                "A good friend will bail you out of jail,
                A true friend would be sitting beside you saying,
                'Wow, that was fun.'"

                Comment


                • #9
                  Re: To know the no. of commented line in program

                  Is that what stinks so bad? And I thought it was my loafers, or my coding
                  Your future President
                  Bryce

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

                  Comment


                  • #10
                    Re: To know the no. of commented line in program

                    Try To Be Serious In Giving Reply. I Thik You All Are Not School Guys.
                    Thanks,

                    Abhishek KUMAR

                    Comment


                    • #11
                      Re: To know the no. of commented line in program

                      abhishek....are you and janorkar classmates??
                      Your future President
                      Bryce

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

                      Comment


                      • #12
                        Re: To know the no. of commented line in program

                        Copy the code to a temporary or personal library and resequence the lines to know the total number of lines. This is another way of doing it. However, I am really not sure what you can define as a comment.
                        .
                        For instance, in a CL program, would the following line be considered a comment?
                        /* This is a comment */ CHGVAR ...
                        .
                        Now for the main thing - can you tell us the purpose of this counting? Is anybody other than Bryce running for president?
                        â??No bird soars too high if he soars with his own wingsâ?? â?? William Blake

                        Comment


                        • #13
                          Re: To know the no. of commented line in program

                          Mr. bryce can you please tell me why are you asking this question that wether janokar is my classmate.
                          Thanks,

                          Abhishek KUMAR

                          Comment


                          • #14
                            Re: To know the no. of commented line in program

                            Well, the question seemed like a school question. And you are both from hyderabad and came on the forum about the same time, about the beginning of the fall semester. It seems very coincidental and there is only a couple solutions to my question.

                            1. You are schoolmates
                            2. You are coworkers and I'm wrong about the school thing.
                            3. It is a coincidence that two guys from hyderabad come onto the forum at the same time.

                            I was going with my gut feeling based on the style of question. That's all.
                            Your future President
                            Bryce

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

                            Comment


                            • #15
                              Re: To know the no. of commented line in program

                              Does it really matter at this point.....we all had to learn at sometime...I would think if the
                              internet was around when I was a young man then I too would have used it. The whole idea
                              of this forum is to bring together programmers and give some of us old people an opportunity
                              to train our replacements

                              Bryce check this out
                              Hyderabad has an estimated metropolitan population of 6.1 million
                              I would guess the odds are pretty good

                              Now for my question -- whats the quickest way to house break a dog?


                              all my love
                              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

                              Working...
                              X