BC.EXE "AS Missing" in TYPE Using Space Between Array and () (68024)






This article was previously published under Q68024

SYMPTOMS

The BC.EXE compiler gives the error "AS Missing" on an array in a TYPE statement if you mistakenly leave a space between the last letter in the array name and the left parenthesis. (This misleading error message will occur only if you create the program in an editor other than QBX.EXE. The problem doesn't occur when you save the program in QBX.EXE because QBX.EXE automatically removes the offending space character.)

WORKAROUND

To work around the problem in any editor other than QBX.EXE, remove the offending space character between the array name and the left parenthesis.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft Basic Professional Development System versions 7.00 and 7.10 for MS-DOS and MS OS/2. We are researching this problem and will new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

To reproduce this problem, enter the following code example into any text editor other than QBX.EXE. (Note that if you load this program into the QBX.EXE environment, the space between the array name and the "(" character will automatically be removed.)
TYPE t1
  s (1 TO 45) AS SINGLE
END TYPE
				
The BC.EXE compiler produces the following output when compiling this code:
Microsoft (R) Basic Compiler Version 7.10
Copyright (C) Microsoft Corporation 1982-1990. All rights reserved.
 0030   0006       s (1 TO 45)  AS SINGLE
                     ^ AS missing
                     ^ Skipping forward to END TYPE statement

45962 Bytes Available
45853 Bytes Free
    0 Warning Error(s)
    2 Severe  Error(s)
				

Documentation Error

Page 390 of the "Microsoft Basic 7.0: Language Reference" for versions 7.00 and 7.10 shows the following incorrect array declaration for CityCode in a TYPE statement:
TYPE StateData
   CityCode (1 TO 100) AS INTEGER ' Declare a static array.
   County AS STRING * 30
END TYPE
DIM Washington(1 TO 100) AS StateData
				
A space needs to be deleted on the CityCode line so that it reads as follows:
   CityCode(1 TO 100) AS INTEGER ' Declare a static array.
				

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