The term virtual file refers to temporary files that can be created in scripts. They only exist for the duration of the script and only exist in memory. They are most useful as receptacles for CSV files read in and for ad-hoc reporting. You can do almost anything with a virtual file that you can on a real file. The main difference is that a virtual file must have its fields declared before the file can be used. You do this using the m.field() function (see later).

The mnemonic for a virtual file number is of the form V##, where ## is a number in the range 01..32, e.g V01, V02, etc.

The key (index) for a virtual file must also be declared before the file can be scanned in anything other than physical order. This is done by implication by referencing a key mnemonic for the file. For example, if virtual file v01 has a field declared of CustomerName, then to create a key on that field, just reference a key (using the m.set() function) with a name of m.v01CustomerNameKey. Only one key can be defined per file and it can only consist of a single field. You can emulate multi-field keys programmatically in the script by using a structured string. Records with null (or empty) keys are not indexed.

Note: It’s more efficient to use an ordinary Lua table if you just need working space, even if that space is very large.