PRB:Feature Not Available Error If EXE Uses Macro Substitution

ID: Q133358

2.50 2.50a 2.50b 2.60 2.60a MS-DOS

 kbprb

The information in this article applies to:

SYMPTOMS

When running a stand-alone EXE (regular or extended) and executing a line of code that uses macro substitution to reference a command verb, a "Feature Not Available" error is encountered.

CAUSE

When FoxPro creates a stand-alone executable file, the project files are scanned for FoxPro commands. The interpretations for these commands are then built into the executable. However, if macro substitution is used to directly reference a command verb, FoxPro does not evaluate the literal text stored to the variable as a FoxPro command. Thus, the interpretation for that command verb is not built into a FoxPro stand-alone executable.

RESOLUTION

Here are four techniques you can use to avoid the problem:

See examples for the first two of these techniques are shows in the "More Information" section of this article.

STATUS

This behavior is by design.

MORE INFORMATION

It is possible to avoid problems associated with the use of macro- substituted references to command verbs without taking any direct action to avoid it. But, in these cases, one of the following has occurred:

Steps to Reproduce Behavior

The following example uses the SET command to demonstrate this behavior:

1. Create a program (for the sake of example, call it Test) that contains

   this code:

   a="SET "  && The space between SET and the closing quote is needed
   b="COLOR TO GR+/R"
   &a&b             && "a" is the command verb, "b" is the command clause
   CLEAR
   WAIT

2. Add the Test program to a new project and build a stand-alone .EXE file.

3. Run the .EXE file independent of FoxPro to see the "Feature Not

   Available" error display.

Example Resolution - Using an Expression

This example demonstrates how to use macro substitution in a command expression instead of in a line of code. If you use macro substitution in an expression, there is no reference to the command verb, so the "Feature Not Available" error is avoided.

1. Modify the Test program so that it contains this code:

   b="COLOR TO GR+/R"
   SET &b           && The command verb SET is not macro substituted
   CLEAR
   WAIT

2. Save the changes to the Project, rebuild the .EXE file, and run it
   independent of FoxPro.

In this case, you are still using macro substitution to reference a portion of the command expression, but not the SET command verb. You should see the screen background color change to red, and the wait message pen color appear as yellow. Because the SET command verb has not been macro- substituted, the translation is built into the .EXE file.

Example Resolution - Reference that Command Verb Elsewhere in the Code

This example shows that you can use a macro-substituted reference to a command verb if there is a non-macro-substituted reference to that command verb within the project.

1. Modify the Test program so that it contains this code:

   SET TALK OFF
   a="SET "   && The space between SET and the closing quote is needed
   b="COLOR TO GR+/R"
   &a&b
   CLEAR
   WAIT

2. Save the changes to the Project, rebuild the .EXE file, and run it
   independent of FoxPro.

3. Again, you have used a non-Macro-Substituted reference to the SET
   command, so the translation is built into the .EXE files.

Additional reference words: FoxDos 2.50 2.50a 2.50b 2.60 2.60a KBCategory: kbprb KBSubcategory: FxprgMacrosub
Keywords          : kbcode FxprgMacrosub 
Version           : 2.50 2.50a 2.50b 2.60 2.60a
Platform          : MS-DOS

Last Reviewed: June 17, 1998