Announcement

Collapse
No announcement yet.

Error 6 Overflow

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

  • Error 6 Overflow

    I am trying to resolve why on occasion my program produces an
    overflow error 6.

    The address points to the following line.

    DIM F AS LOCAL INTEGER
    DIM EdStr AS LOCAL STRING
    DIM S AS local string
    EdStr=CusStreet+CusCity+CusState
    EdStr=EdStr+MKL$(CusZip)
    =>EdStr=EdStr+MKQ$(CusTel)
    EdStr=EdStr+MKL$(CusDate)
    EdStr=EdStr+CusMemo1+CusMemo2
    EdStr=EdStr+MKL$(CusBalance)
    EdStr=EdStr+MKL$(CusLimit)

    CusTel is Dimed as Shared Quad

    How can I get a value in CusTel that would cause the error 6?

    Is the error address accurate?

    The program is compiled with the following directives. I am using PB 3.5

    $STRING 8
    $STACK 4096
    $LIB ALL OFF ' 11-04-97
    $DIM ALL

    Any ideas would be appreciated?



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

  • #2
    I've had this type of problem before. One time, I had an error
    on "crlf$ = chr$(13) + chr$(10)". Real head scratcher.

    However, if I looked up a few lines, I noticed a mistake in my
    code. Fixing that error fixed the posted error.

    Now your problem may be the result of variables. Some, your
    program may like, others it don't.

    I would suggest, for debugging purposes, injecting an "ON ERROR"
    trap in your program. When it errors out, jump to a routine and
    list the values of all your variables. You might find something
    there.


    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      I have an on error routine that writes an error log file.
      I have include a portion of the error log below.
      The CusTel varaible looks fine.

      C:Tel 22 = |( ) - 0|

      The code to print the variables is

      For X = 1 To %VariableCount
      Print #F,Mid$(nvar(X),1,11)+" = |"+VariableToString(X)+"|"
      Next X

      The mask used in the VariableToString(X) routine for CusTel is

      mVar(%FCusTel) = "(###) ###-####"

      Here is the error log
      -------------------------
      Error 6 at PC- 262527
      Occured in:Version 8.00 Revision .16
      -------------------------
      03-29-2005 20:47:21
      -------------------------
      Check Line Counter: 14
      PageName =RETRIEVE
      MarginName =RETRIEVE
      WindowName =SECRETCD
      ControlName =TENDERCT
      ChainName =TENDER
      Inst Number= 55
      Quantity 1 = | 1|
      PassCode 2 = | 1|
      Table No 3 = |C/O|
      Covers 4 = | 0|
      Emp Name 5 = | CASH DRAWER 1 |
      $ Amount 6 = | 12.01|
      Date 7 = |Mar 29, 2005|
      Time 8 = | 8:47pm|
      Main Lvl 9 = |0|
      Aux Lvl 10 = |0|
      Amt Due 11 = | -10.00|
      Chng Due 12 = | 6.00|
      CustName 13 = | |
      Branch 14 = | 1|
      Active V 15 = | |
      C:Accnt 16 = | 3597726|
      C:Name 17 = |CANDY |
      C:Street 18 = | |
      C:City 19 = | |
      C:State 20 = | |
      C:Zip 21 = | |
      C:Tel 22 = |( ) - 0|
      C ate 23 = |Mar 29, 2005|
      C:Memo1 24 = | |
      C:Memo2 25 = | |
      C:Balnce 26 = | 12.01|
      C:Limit 27 = | 1.00|
      Chk Num 28 = | 114|
      Ord Type 29 = |C/O |
      Chk Amt 30 = | 12.01|
      Seat Num 31 = | 0|
      Gratuity 32 = | 0.00|



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

      Comment


      • #4
        Hi Doug!

        The most likely cause is that there's some sort of memory corruption happening. PB/DOS maintains an internal byte of memory to flag a numeric error, and I'd guess that something is happening in the lines preceding this one which causes that flag to be overwritten (incorrectly). Then, during the MKQ line of code, PB checks the flag, sees that it's set, and reports an error. This flag is checked on almost every float or quad integer operation, so it's very likely it's happening in the code which executes immediately prior to that you've shown us. Unfortunately, there isn't enough code shown here to be more specific right now.

        Regards,

        Bob Zale
        PowerBASIC Inc.

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

        Comment


        • #5
          Shouldn't ON ERROR GOTO flag the error "at the exact time it happens?"

          I don't see an error-handler in the above code.

          Even if you don't want to go into production with it, surely this would be a quicker way to find the error than testing ERR after each line of code or writing endless lines of 'log' entries.

          Or, as much as I'm not a big fan of using a stepping debugger for general development purposes, this surely is the place for it, no? It should only take a few minutes to recompile for use with the PB/DOS stepping debugger. (Can't remember if you can watch ERR in PB/DOS or not.)

          MCM


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

          Comment


          • #6
            The code provided is at the top of a SUB.
            Should I look at the SUB

            SUB CusStoreRecord
            DIM F AS LOCAL INTEGER
            DIM EdStr AS LOCAL STRING
            DIM S AS local string
            EdStr=CusStreet+CusCity+CusState
            EdStr=EdStr+MKL$(CusZip)
            => EdStr=EdStr+MKQ$(CusTel) error address points here
            EdStr=EdStr+MKL$(CusDate)
            EdStr=EdStr+CusMemo1+CusMemo2
            EdStr=EdStr+MKL$(CusBalance)
            EdStr=EdStr+MKL$(CusLimit)
            EdStr=EdStr+MKI$(CusStatus)

            Does that mean I should look at routine that called this SUB?

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

            Comment


            • #7
              Yes, you should look at the code which calls the SUB. That's the most likely source of the problem.

              Regards,

              Bob Zale
              PowerBASIC Inc.


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

              Comment

              Working...
              X