---------------------------------------------------------- back to tips menu
Resolving EXE Problems
1. Cryptic Errors that Mean Something
Some PowerBuider errors are very puzzling but they have predictable causes. Seee errors listed in the table below:
|Cryptic Error||Usual Meaning|
|Cannot find PBSHR060 (or PBSHR050)||This usually means that the runtime DLLs (or development library DLLs) and not in the current directory or the path.|
|PBSHR060 (or PBSHR050) is corrupted||This error can be an indication that the PBSHR050 (60) DLL is out of date or the wrong version (e.g. 16 bit version instead of 32 bit version or vice-versa). Find all PBSHR050 (60) DLL's on the drive and determine whether the correct one is first in the path.|
|IM003 error: specified driver could not be loaded.||When using SQL Anywhere, this means that SQL Anywhere's win32 directory could not be located. Ensure it is included in the search path.|
|PB060 (or PB050) does not exist
||This is usually occurs when the DBMS property
for the transaction object is not properly initialized (e.g. either not set in script or
not found in application INI file).
|Unable to load requested database interface...
DBMS xxx is not supported at your installation
|Usual cause: the required Powersoft database DLL (named PBxxx60.DLL for 32-bit or PBxxx60w.DLL for 16-bit) is not installed or is not in the path.|
|Stack fault||This usually indicates that too many recursive function calls were made. There may be an endless loop in a recursive call or the problem being solved may just require too many levels of recursion.|
2. Figuring out a Problem in EXE but not Development Environment
One of the more frustrating experiences occurs when an application works in the development environment but does not work as an executable. The general method to do a thorough application regeneration and then to track down the problem in the EXE by tracing.
Once you have narrowed down the problem to a few lines of code through tracing, you will generally find the EXE problem is caused by one of the following:
Before spending much effort tracking down an EXE problem, you should:
You can greatly reduce the number of problems you have with dynamically referenced objects by using the simple/safe EXE configuration described in a later tip. The discussion that immediately follows does not assume that you have adopted the suggested configuration.
Any objects that were dynamically assigned in script could potentially cause a problem in your EXE. Several dynamically assigned objects are reviewed:
A Dynamic Bitmap, Icon, Cursor, etc.
// assign a bitmap dynamically lm_mymenu.m_file.m_save.ToolBarItemName = "save2.bmp"
All bitmaps, icons and cursors should either be included in the resource (PBR) file or you should ensure that they are in the user's runtime path.
A Dynamic DataWindow Object
// assign a DataWindow object to a DataWindow control (or DataStore) dw_list.DataObject = "d_specialorder"
To ensure the DataWindow object is included in the EXE, either make sure that the DataWindow (d_specialorder) is an a PBL that will be generated into a PBD/DLL or make sure it is included in the resource (PBR) file.
A Dynamic Window or Dynamic User Object
// open a window using a dynamic window name Open(w_window,"w_CustDetail")
Unlike dynamic DataWindows, Windows and User Objects cannot be included in your resource file. If the Window or User Object is not in a PBL that is being generated into a PBD/DLL, then use the following trick: declare a dummy function on your application object f_dummy().
In the variable declaration for that function, create a dummy variable for each dynamic windows and user objects:
u_CalcPay luo_CalcPay w_CustDetail lw_CustDetail
This will ensure that the dynamic windows and user objects get included in the EXE.
Once you have a clean EXE (with all dynamic objects included), you need to ensure that your runtime environment is set up properly. Consider the following environmental problems:
|PB.INI not used in EXE||An executable will not obtain information from the PB.INI file, as the development environment does. That means that database information (e.g. DBMS property) should be kept in the application INI file and read from that location by the application.|
|Runtime DLL's installed and in search path||When running the EXE on the user machine, you
will need to install the PowerBuilder DLL's before your PowerBuilder application will run.
Also, if you are running any add-ons (e.g. PFC, Formula-1), additional DLL's will be
required. See the PowerSoft documentation for details on the DLL's you will need for your
version of PowerBuilder. Check the PowerBuilder documentation for the latest list of
required DLL's for your configuration.
These runtime DLL's should either be in the same directory as the application (i.e. the "current directory" for the application) or they should be somewhere in the user's search path.
Be sure that the DLL's deployed to users are the same versions as those used in the development environment -- otherwise the user might have problems that you can't duplicate in development.
|Conflicting DLL's||Sometimes you might find that your application runs fine when it is running alone but it fails when another application at the same time. The probable cause: both applications use the same DLL but the other application is loading an older version of the DLL into memory before your PowerBuilder application starts.|
If you have a clean EXE and your environment is set up properly, then you can say "this should work". PowerBuilder EXEs should always behave the same as the development environment but this is not always the case. PowerBuilder is actually running different code when it executes the code dynamically in the development environment compared to compiled P-code or machine code. Clearly, PowerSoft tries to keep these perfectly in synch but it does not always succeed.
What should you do? First, trace the problem so you have figured out what is not working properly. Second, review the InfoBase. If you can't get a maintenance release that has fixed the problem, you will need to try to workaround the problem.
EXEs cannot be debugged directly but they can be easily traced. P-code EXEs can always be traced. Machine code executable require that you regenerate the EXE with the Trace Option checkbox checked (in the Project Painter).
To trace, run your Application with the using the pbdebug switch on (e.g. "myapp /pbdbug"). PowerBuilder should create a text file like "myapp.dbg". This trace should list each line of script executed. The trace file grows quickly so cause the application problem as soon as possible.
If you are tracking down a GPF, the last line of the trace file will generally be the line that GPF'd. At times, a GPF is not reproducable with the debug option on (annoying, PowerBuilder may not GPF with your problem when the EXE is running with pbdebug). Iin these cases, you may have to to use MessageBoxes to track down the line(s) of code causing your problem.
Sample strategies for working around PowerBuilder problems (such as GPFs) are reviewed on this site.
4. A Simple/Safe EXE Configuration
Many experienced PowerBuilder believe that the simplest and safest EXE configuration is as follows:
This configuration provides the following benefits:
Prior to PB5, performance could be improved by placing commonly used ancestors in the EXE itself. With improved executables/PBD access in PB5 and later, you should get comparable performance (and fewer headaches) with simpler configurations like the one just described.
PowerBuilder execution errors (current for PB6) are listed in the table below.
|1||Divide by zero|
|2||Null object reference|
|3||Array boundary exceeded|
|4||Enumerated value is out of range for function|
|5||Negative value encountered in function|
|6||Invalid DataWindow row/column specified|
|7||Unresolvable external when linking reference|
|8||Reference of array with null subscript|
|9||DLL function not found in current application|
|10||Unsupported argument type in DLL function|
|11||Object file is out of date and must be converted to current version|
|12||DataWindow column type does not match GetItem type|
|13||Unresolved property reference|
|14||Error opening DLL library for external function|
|15||Error calling external function name|
|16||Maximum string size exceeded|
|17||DataWindow referenced in DataWindow object does not exist|
|18||Function doesn't return value|
|19||Cannot convert name in Any variable to name|
|20||Database command has not been successfully prepared|
|21||Bad runtime function reference|
|22||Unknown object type|
|23||Cannot assign object of type name to variable of type name|
|24||Function call doesn't match its definition|
|25||Double or Real expression has overflowed|
|26||Field name assignment not supported|
|27||Cannot take a negative to a noninteger power|
|28||VBX Error: name|
|29||Nonarray expected in ANY variable|
|30||External object does not support data type name|
|31||External object data type namenot supported|
|32||Name not found calling external object function name|
|33||Invalid parameter type calling external object function name|
|34||Incorrect number of parameters calling external object function name|
|35||Error calling external object function name|
|36||Name not found accessing external object property name|
|37||Type mismatch accessing external object property name|
|38||Incorrect number of subscripts accessing external object property name|
|39||Error accessing external object property name|
|40||Mismatched ANY data types in expression|
|41||Illegal ANY data type in expression|
|42||Specified argument type differs from required argument type at runtime in DLL function name|
|43||Parent object doesn't exist|
|44||Function has conflicting argument or return type in ancestor|
|45||Internal table overflow; maximum number of objects exceeded|
|46||Null object reference cannot be assigned or passed to a variable of this type|
|47||Array expected in ANY variable|
|48||Size mismatch in array to object conversion|
|49||Type mismatch in array to object conversion|
|50||Distributed Service Error|
|51||Bad argument list for function/event|
|52||Distributed Communications Error|
|53||Requested server not active|
|54||Server not accepting requests|
|55||Request terminated abnormally|
|56||Response to request incomplete|
|58||Object instance does not exist|
|59||Invalid column range|
|60||Invalid row range|
|61||Invalid conversion of number dimensional array to object|
|63||Function/event with no return value used in expression|
|64||Object array expected in left side of assignment|
|65||Dynamic function not found. Possible causes include:\npass by value/reference mismatch|
|66||Invalid subscript for array index operation|
|67||NULL object reference cannot be assigned or passed to an autoinstantiate|
|68||NULL object reference cannot be passed to external DLL function name|
|69||Function name cannot be called from a secured runtime session|
|70||External DLL function name cannot be called from a secured runtime session|
|71||General protection fault occurred|
|72||Name failed with an operating system error code of number|
|73||Reference parameters cannot be passed to an asynchronous shared/remote object method|
|74||Reference parameters cannot be passed to a shared object method|
|75||The server has forced the client to disconnect|
|76||Passing NULL as a parameter to external function name|
|77||Object passed to shared/remote object method is not a nonvisual user object|
|78||Listen can only be done in Enterprise version of PowerBuilder|
|79||The argument to name must be an array|
|80||The server has timed out the client connection|
|81||Function argument file creator must be a four character string|
|82||Function argument file type must be a four character string|
|83||Attempt to invoke a function or event that is not accessible|
|84||Wrong number of arguments passed to function/event call|
|85||Error in reference argument passed in function/event call|
|86||Ambiguous function/event reference|
|87||The connection to the server has been lost|
|88||Cannot ask for ClassDefinition Information on open painter: name|
|89||5.0 style proxy objects are not supported. Copy the new style proxy that was generated at migration time|
|90||Cannot assign array of type name to variable of type array of name|
---------------------------------------------------------- back to tips menu