Announcement

Collapse
No announcement yet.

strange error message 11

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

  • strange error message 11

    I want to debug a programm therefore I set different PRINT commands to show me the values of different parameters.
    I know, this is no cute method, but I am not able to work with the Debugger.

    This method worked well all the time long.

    But now, I - runnig the program - always get the error message 11 (division by zero).
    There are definitly no divisions by zero (all input-varaible > 0).
    I found out, that this error message shows also if the is a dta file missing (but in this case, no data file is missing).

    Could anyone of You please give me additional information on this error message 11, I would be very grateful fpr any hint.

    Thanks

    Wolfgang

  • #2
    Have you been able to identify the line of code which seems to generate the error ?

    If it's a statement which is impossible that is causing an error 11, then some kind of memory corruption might occure somewhere else in your code; this kind of problems can very well show up later in parts of code that have nothing wrong.

    Does the error only occur when you add the PRINTs ? This would make the above more likely.

    I found out, that this error message shows also if the is a dta file missing
    I wasn't aware of this, can you elaborate on this ?

    ------------------
    Davide Vecchi
    [email protected]

    Comment


    • #3
      >Have you been able to identify the line of code which seems to generate the error

      With PB/DOS, you can get the source code line where an error occured by compiling with the "Find Error" option. (just write down the "PC:nnnnnn" value when the program terminates)

      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Thanks for Your quick answer.

        It's true, the error message refers to a line with only the print command.

        I do not understand the expression "memory corruption, is this a hardware problem or a difficulty of memory organisation?

        And what can I do to find out the real cause?

        Many thanks in advance

        Wolfgang



        ------------------

        Comment


        • #5
          Hi Michael,

          I could exactly locate the line of code which semms to be the cause with the find error option. This line shows only Print commands.

          A mistake in programming resulted in the same message: PRINT TAB(5);STR$(62,""). Just inserting one blank in between the " " and the message faded away..

          The error messages are sometimes not exactly what the book tells us..

          Wolfgang



          ------------------

          Comment


          • #6
            > PRINT TAB(5);STR$(62,"")

            You have found a bug: that should have generated a compile-time error.

            The optional second parameter to the STR$() function is supposed to be an integer in the range 1 to 18, not a string.

            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Wolfgang,
              the error message refers to a line with only the print command.
              Then it's almost sure that there is some memory corruption, unless the expression you are PRINTing divides something by 0.

              "Memory corruption" expression, talking in general, is used to describe a situation where some data is written into a memory location where it shouldn't be written; a classic cause is writing to an array element out of the array bounds (for example using "MyArray(101)" while the array was DIMensioned with "DIM MyArray(1 TO 100)". I don't have the knowledge to explain memory corruption more in details.

              The first thing to do, if you aren't already doing so, is using $ERROR ALL ON.

              Try to check all your references to arrays, to make sure you never write out of array bounds.

              Is it PB/DOS 3.5 ?

              > PRINT TAB(5);STR$(62,"")
              You have found a bug: that should have generated a compile-time error.
              If you write that same line in a one-line program, does this error goes unnoticed as well ?

              ------------------
              Davide Vecchi
              [email protected]

              Comment


              • #8
                When it tries to compile the line PRINT TAB(5);STR$(62,"") it should give
                the following.
                Error 420: Relational operator expected
                That is what I get using PB 3.5 running on WinXP Home SP2
                KS

                ------------------

                Comment


                • #9
                  Then probably either it's not 3.5, or it's not a bug but a behavior also due to the memory corruption. I'd really be surprised that such a bug was here.

                  ------------------
                  Davide Vecchi
                  [email protected]

                  Comment


                  • #10
                    Hi Davide, Michael, keith,

                    now I found the solution:
                    first some information: I use PB 3.5 and I made a mistake in writing the other cause for a faulty error message. It should have been: PRINT TAB(5);string$(62,""). I do not use any array in my code. I also got this error message if one of the PBC-Files of my program was missing.

                    The soultion was:
                    there has been a real division by Zero, but the error message gave a faulty place number. I must apologize not having checked my Code thoroughly before putting questions in the forum. Sorry for that, but Thanks for all information (teh command $ERROR ALL ON was new for me).

                    Wolfgang



                    ------------------

                    Comment


                    • #11
                      Hi Wolfgang,
                      glad that you solved the problem. I really don't think you have to apologize.

                      You should always use $ERROR ALL ON at least while debugging.

                      If you aren't already using it, give a look at $DIM ALL too; it will make the compiler throw a compilation error if you mistyped a variable name, by forcing you to declare all the variables you use. If you don't mind declaring all your variables, it will save you several debugging headaches.

                      ------------------
                      Davide Vecchi
                      [email protected]

                      Comment


                      • #12
                        FWIW, the MOD function can generate a divide by zero error, too.
                        Michael Mattias
                        Tal Systems Inc. (retired)
                        Racine WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment

                        Working...
                        X