Main Menu

KB#00650-Error 46 when executing a BBx SELECT with a SORTBY clause

Title:

Error 46 when executing a BBx SELECT with a SORTBY clause

Description:

Under DOS/Win/Novell, BBx will almost always return an Error 46 when the SELECT verb (as opposed to an SQL SELECT) runs into problems. It can be thought of as "A SELECT error has occurred; see the TCB(10) for the real error." In the case where the TCB(10) is a positive number, the error is a BBx error rather than an operating system error. Because we're looking at a positive TCB(10), you must subtract one to get the real BBx error. So, for example, if the TCB(10)=13, it would mean that the SELECT is failing due to a BBx Error 12, missing or duplicate file. 

One of the most common causes for a select error is BBx's inability to correctly create a temporary sort file (necessary when using a SORTBY). If the error 46 goes away when the SORTBY clause is removed, it indicates that BBx didn't have a valid place to create a temporary mkeyed file. This file is used to temporarily store the selected records so that they can be read back to the application in sorted order. 

In order to ensure that the temporary file can be created, an environment variable named TMPDIR must be set. This should be set to point to a directory that BBx can use to create temporary files. When setting this variable, ensure that the device containing the directory has enough space left, and that the BBx or Data Server process will have sufficient rights to create, write, and erase files in it. 

The TMPDIR environment variable will either be set for the client's environment or the Data Server's environment, depending on how the file is selected. If the file is opened via a drive or directory (not via a Data Server) the TMPDIR environment variable must be set in the client's environment. That means that the TMPDIR variable should be set to point to a valid directory before BBx is run. If the file is opened via the Data Server in the SELECT statement, the TMPDIR environment variable must be set in the Data Server's environment. That means the TMPDIR variable should be set to point to a valid directory in the shell before the Data Server is initially started. If the Data Server is started via a cron script, the variable should be set in the script just before the server is invoked. 

If the client or Data Server is running under NT, the TMPDIR variable should be set from the Control Panel - System - Environment. Note that you may have to reboot the NT machine in order for the variable to take effect. 

If the client is running under Windows 95, the TMPDIR variable should be set from the autoexec.bat file so that it takes effect for all sessions under Windows. 

If the TMPDIR variable has already been set and the error persists, ensure that: 

1) The directory pointed to by the TMPDIR environment variable exists. 
2) BBx can write to that directory so that it can create the sortby file (the drive is not dsksyn'd). 
3) The drive has enough space. 
4) You have adequate permissions to write to that directory. 
5) If it is a local drive under DOS/Novell, ensure that SHARE is loaded. 



Last Modified: 02/23/2004 Product: PRO/5 Operating System: All platforms Error Number: 46

BASIS structures five components of their technology into the BBx Generations.

  Google+ View BASIS LinkedIN Profile Visit our Twitter Feed Check out our Facebook Public Profile Click to View the BASIS youTube channel