Announcement

Collapse
No announcement yet.

Error 6 Overflow

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

    Error 6 Overflow

    My program produces an error 6 overflow on occassion. The address points to
    the first line of code in the following SUB, I have a diagnostic routine that writes all the variables to an
    error log, they look fine. The program is not compiled with DEBUG.
    I assume the error is somewhere within this SUB. I am using PBDOS comipiler 3.5.
    Any idea how I can isolate the error. Compiling with debug prodruces Too big an EXE.

    SUB CusStoreRecord
    DIM F AS LOCAL INTEGER
    DIM EdStr AS LOCAL STRING
    DIM S AS local string
    =>EdStr=CusStreet+CusCity+CusState+MKL$(CusZip)+MKQ$(CusTel)+_
    MKL$(CusDate)+CusMemo1+CusMemo2+MKL$(CusBalance)+_
    MKL$(CusLimit)+MKI$(CusStatus)+CusExtra1+CusExtra2
    If Len(EdStr)<>180 then
    CusCity = Left$(CusCity,12)
    CusState = Left$(CusState,2)
    CusMemo1 = Left$(CusMemo1,40)
    CusMemo2 = Left$(CusMemo2,40)
    CusExtra1 = Left$(CusExtra1,20)
    CusExtra2 = Left$(CusExtra2,20)
    CusStreet = Left$(CusStreet,20)
    EdStr=CusStreet+CusCity+CusState+MKL$(CusZip)+MKQ$(CusTel)+_
    MKL$(CusDate)+CusMemo1+CusMemo2+MKL$(CusBalance)+_
    MKL$(CusLimit)+MKI$(CusStatus)+CusExtra1+CusExtra2
    End If
    IF Len(EdStr) <> 180 THEN
    PRINT "JAMIE, IT DOESN'T WORK."
    STOP
    END IF
    CALL OpenNetFile(DataDIR+"CusAcnt.DAT","BW",F,%True,0)
    If CusRecord Then
    Seek #F,(CusRecord-1)*5
    Else
    Seek #F,LOF(F)
    CusRecord=LOF(F)/5+1
    End If
    Put$ #F,"|"+MKL$(CusAccount)
    Close #F
    CALL OpenNetFile(DataDIR+"CusName.DAT","BW",F,%True,0)
    Seek #F,(CusRecord-1)*17
    Put$ #F,"|"+CusName
    Close #F
    CALL OpenNetFile(DataDIR+"Customer.DAT","BW",F,%True,0)
    Seek #F,(CusRecord-1)*180
    Put$ #F,EdStr
    Close #F
    End SUB
    $

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

    #2
    If you use this definiton for edstr
    Code:
    CusCity = Left$(CusCity,12)           '12
    CusState = Left$(CusState,2)          '14
    CusMemo1 = Left$(CusMemo1,40)         '54
    CusMemo2 = Left$(CusMemo2,40)         '94
    CusExtra1 = Left$(CusExtra1,20)       '114
    CusExtra2 = Left$(CusExtra2,20)       '134
    CusStreet = Left$(CusStreet,20)       '154
    EdStr=CusStreet+CusCity+CusState+MKL$(CusZip)+MKQ$(CusTel)+_
    MKL$(CusDate)+CusMemo1+CusMemo2+MKL$(CusBalance)+_
    MKL$(CusLimit)+MKI$(CusStatus)+CusExtra1+CusExtra2
    Then the length is at 180 before you add CusExtra1 and CusExtra2 because
    mkl$ takes 4 bytes, mkq$ takes 8 bytes and mki$ takes 2 bytes.
    KS

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

    Comment


      #3
      The strings total 154 plus the mk?$ adds 26 for a total of 180
      I assume the string manipulation is not causing the error 6.

      The error 6 help files says result of a calculation too big to
      fit in a variable. It must be one of the math statements used
      after the edstr setup.



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

      Comment


        #4
        Your right I missed them, I must be going blind.
        KS

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

        Comment


          #5
          Hello Martin,

          Error 6 causes an overflow in the Variable Value or string length.

          Check Your MkI$ statements if the Variable e.g. CusStatus is too
          high = over 32767 or too low under 32768. (check variables of the
          mkl$ and mkq$ too)

          perhaps You make an error check before e.g.
          If CusStatus > 32767 or cusStatus <-32768 then do something

          next turn off/on the menupoint " Compiler / errortest / overflow"
          to run the program an look then to wrong results in the data file.

          the last is make a little program with minimal nessessary routines
          and functions that will run in the IDE.

          Hope this helps.

          Regards

          Matthias Kuhn

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

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎