Can't READ DATA Statements Across Basic Modules (58037)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q58037

SUMMARY

The READ statement cannot read DATA statements that are in another module. READ statements are allowed within subprograms, but will only read DATA statements that are in the same module that the subprogram is in. DATA statements themselves cannot be included inside SUB or FUNCTION procedure definitions; they must be located at the module level code of each module.

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2, and to Microsoft Basic Professional Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.

MORE INFORMATION

If a READ statement is executed and there are no DATA statements in that module, an "Out of data" error is generated. The READ statement does not look for DATA statements in other modules. This limitation of the READ statement is not explicitly stated in any documentation. This information needs to be added to the READ and DATA statements (listed alphabetically) in the following manuals:

  1. "Microsoft QuickBasic 4.5: Basic Language Reference" for Version 4.50
  2. "Microsoft QuickBasic 4.0: Basic Language Reference" manual for Versions 4.00 and 4.00b
  3. "Microsoft QuickBasic Compiler" Versions 2.0x and 3.00 manual
  4. "Microsoft Basic Version 7.0: Language Reference" manual
  5. "Microsoft Basic Compiler 6.0: Basic Language Reference" for Versions 6.00 and 6.00b

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB58037