"Permission Denied" If SHELL to 7.00 .EXE Using ISAM from TSR (63782)






This article was previously published under Q63782

SYMPTOMS

If you use SHELL to shell out from one program that uses ISAM to another ISAM program that uses the PROISAM.EXE or PROISAMD.EXE terminate-and-stay- resident (TSR) program, a "Permission Denied" error occurs when the OPEN statement is executed in the child (shelled) process (see Example 2 below). This problem does not occur when ISAM support is linked into the .EXE programs instead of using the TSR program.

In addition, using SHELL to shell out to the ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE, or ISAMPACK.EXE) may generate unusual error messages, because they are not designed to be shelled; this is not a software problem but is a design limitation. For example, ISAMPACK.EXE fails with the message "Unknown error number." A workaround is shown below in Example 1.

WORKAROUND

To work around this problem, use a CHAIN statement instead of SHELL, or LINK ISAM support to your .EXE instead of using the ISAM TSR program.

STATUS

Microsoft has confirmed this to be a bug in Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The SETUP.EXE program for Basic PDS 7.00 and 7.10 lets you choose one of the following four ISAM support options for compiled .EXE programs:

  1. ISAM Routines in TSR
  2. ISAM Routines in LIB, Support Database Creation and Access
  3. ISAM Routines in LIB, Support Database Access Only
  4. No ISAM support
Only Option 1 creates PROISAM.EXE and PROISAMD.EXE TSR programs that can be used with Basic compiled .EXE programs. The TSR program created in Option 1 can also be used in QBX.EXE. Options 2 and 3 create PROISAM.EXE and PROISAMD.EXE TSR programs that CANNOT be used in compiled .EXE programs, and that can only be used by QBX.EXE and the ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE, and ISAMPACK.EXE). Options 2 and 3 create .LIB libraries for linking ISAM support into your .EXE programs. The fourth SETUP option does not copy any ISAM-related files onto your computer.

A problem occurs whenever a shelled (child) process attempts to access the PROISAM or PROISAMD TSR program. Specifically, the problem occurs when you shell to an ISAM utility (which requires the TSR program -- see Example 1), or shell to a Basic .EXE program that requires the ISAM TSR (see Example 2).

Example 1

Because the ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE, or ISAMPACK.EXE) require the ISAM TSR program, the best way to work around the SHELLing problem is to link the Basic .EXE (the parent process that executes the SHELL) to the ISAM .LIB, and then SHELL to an MS-DOS batch (.BAT) file that loads the TSR program, executes the ISAM utility, and then unloads the TSR program. The following is an example of this type of batch file:
   REM  Start PACK.BAT
      PROISAMD
      ISAMPACK isamfile.dat
      PROISAMD /D
   REM  End PACK.BAT
				

Example 2

The following program (when SHELLed to itself or any other program that OPENs any ISAM file) will cause a "Permission Denied" error in the SHELLed copy:
   ' ISAMTEST.BAS
   TYPE test
     x AS INTEGER
   END TYPE
   OPEN "test" FOR ISAM test "test" as #1
   CLOSE #1
   INPUT "Do you want to shell?", a$
   IF a$="Y" THEN SHELL "ISAMTEST"    ' Put the name of this .EXE here.
   END
				
Compile and link this program as follows:
   BC ISAMTEST.BAS;   (BC compile options don't affect the problem)
   LINK ISAMTEST;
				
To duplicate the problem, run the PROISAM.EXE or PROISAMD.EXE TSR program, then run the above program. To work around the problem, link ISAM support to the program instead of using the ISAM TSR program, or use CHAIN instead of SHELL.

Note that if you chose the "ISAM routines in TSR" option during SETUP.EXE and also retained component files during SETUP.EXE, there is a special way to LINK ISAM support into your stand-alone .EXE program, as described in a separate article, which can be found by using the following query in this Knowledge Base:
   LINK and ISAM and component and even and SETUP and TSR
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB63782