Announcement

Collapse
No announcement yet.

Close Err 51

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

  • Close Err 51

    I execute the CLOSE command in my program immediately before leaving PBMAIN (no parameters). This causes an ERR 51. Is this normal?

  • #2
    Lee,

    Can you show the code?

    This simple test does not give the error.

    Code:
    #Compile Exe
    #Dim All
    Function PBMain () As Long
        Close
    End Function
    Also, Help says this for Err 51

    Error 51 - Internal errorInternal error - (%ERR_INTERNALERROR) - A malfunction occurred within the PowerBASIC run-time system, or the operating system reported an error that PowerBASIC was not expecting (or was unable to decipher). For example, attempting to KILL (delete) an open file can cause this kind of problem.
    If you are unable to identify the cause of the problem, contact the PowerBASIC Technical Support group with information about your program.
    Without your code, it's hard to know what you might have done!
    Last edited by Gary Beene; 23 Feb 2009, 01:48 PM.

    Comment


    • #3
      Originally posted by Lee Bergeron View Post
      I execute the CLOSE command in my program immediately before leaving PBMAIN (no parameters). This causes an ERR 51. Is this normal?
      No, it's not normal. My guess is that something else is happening before you get to the CLOSE statement.
      Software makes Hardware Happen

      Comment


      • #4
        A close with no open files?

        Ahh, no "user visible" open files?
        Furcadia, an interesting online MMORPG in which you can create and program your own content.

        Comment


        • #5
          Not to be too naive here, but if the doc says when this happens you should send info to the PowerBASIC Technical support group and they even give you a "clickable link" , don't you think they might really mean it?
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            I assumed that they put that caveat in all error message descriptions, but I checked a dozen or more error message Help sections and didn't see it anywhere else!

            If you are unable to identify the cause of the problem, contact the PowerBASIC Technical Support group with information about your program.
            Seems odd that they knew something was iffy about CLOSE - to the point they singled it out in Help, asking for user feedback on possible problems. But they did.

            Comment


            • #7
              The application is fairly massive - it's a program that is a bridge between a proprietary application and DDOC. Simply though, CLOSE is CLOSE and it shouldn't matter what the rest of the Code looks like. The reason I believe CLOSE is causing the problem because I ERRCLEAR before the statement then MSGBOX the ERR# after the statement and it displays ERR 51. Would CLOSE attempt to Close files opened in the DLLs of DDOC and therefor cause this ERR? It's not a problem, just wanted to know.

              Comment


              • #8
                The reason I believe CLOSE is causing the problem because I ERRCLEAR before the statement then MSGBOX the ERR# after the statement and it displays ERR 51
                Bad assumption. ERR 51 may have been set prior to the CLOSE. Or, some other error condition may have existed at that time, and attempting CLOSE while that error condition exists may be exactly what causes CLOSE to generate a '51' error.

                AFAIK, CLOSE could only close files for which the PB handle was obtained in the current code module... because those handles are only valid in the current code module and the current module does not know squat about handles obtained in another module.

                Anything in another module (eg ddoc.dll) has to be closed in that other module, or allowed to close when the process ends (aka "letting your mama cleanup after you").

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

                Comment


                • #9
                  Lee --

                  Is it possible that you are deleting the file that is open, before you close it? I don't know if it's still the case, but that used to cause an ERR 51 on a CLOSE.

                  -- Eric
                  "Not my circus, not my monkeys."

                  Comment


                  • #10
                    One that often causes a CNDS problem is "Things you can NOT see, and did NOT know you opened" comes to mind

                    If you can post compilable code to example, that will either show you where the problem is...or show us where the problem is.

                    (yep I do know the side of "Its too HUGE to post" vs attempting to post and realize :doh:

                    Engineer's Motto: If it aint broke take it apart and fix it

                    "If at 1st you don't succeed... call it version 1.0"

                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                    Comment


                    • #11
                      Originally posted by Gary Beene View Post
                      I assumed that they put that caveat in all...
                      Gary--
                      That's not a caveat. It's a suggestion as to how you may obtain additional help when needed.

                      Seems odd that they knew something was iffy about CLOSE - to the point they singled it out in Help, asking for user feedback on possible problems. But they did.
                      No, that simply is not true. There is nothing "iffy" about the CLOSE statement. We have not singled it out in the Help file. We have not asked for user feedback on possible problems. This is very disappointing commentary, because it could easily misinform the casual reader.

                      Bob Zale
                      PowerBASIC Inc,

                      Comment


                      • #12
                        CLOSE is not singled out, not really.

                        See definition of error 51 in the errors section of the help file.

                        Well, since you don't want to do it I'll paste it....

                        Error 51 - Internal error
                        Internal error - (%ERR_INTERNALERROR) - A malfunction occurred within the PowerBASIC run-time system, or the operating system reported an error that PowerBASIC was not expecting (or was unable to decipher). For example, attempting to KILL (delete) an open file can cause this kind of problem.

                        If you are unable to identify the cause of the problem, contact the PowerBASIC Technical Support group with information about your program.
                        I do find it interesting that PB says here it only wants to be notified if the user CANNOT identify the cuase of the problem... as though a user WOULD be able to debug the runtime.

                        I would think PB would want to know whenever code causes the runtime to throw such a 'generic' error so they could identify the problem and fix it up to return something meaningful to the user.

                        I wasn't in the room when that decision was made.

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

                        Comment

                        Working...
                        X