DATA_USE

Syntax DATA_USE default_device
Location Toolkit II, THOR XVI

If you have Toolkit II installed, all of the additional extensions connected with file or device handling and all original SuperBASIC commands use the default device if no other device name is specified.

On a THOR XVI, some of the commands support default devices without Toolkit II.

The effect of the default devices would make LOAD proggy_bas work as LOAD flp1_proggy_bas (assuming that flp1_ is the default data device). The actual effect depends on the command being executed, but generally the file will be looked for in three steps:

  • Does the given file include a valid device? proggy_bas does not, ram1_proggy_bas does (ram1_). If not, the parameter is assumed to be a filename and Toolkit II looks for a device on which it can find it; so:
  • Add the default data device to the filename. If that does not work, then:
  • Add the default program device (PROGD$) and try again.

The default program device is defined by PROG_USE, DATA_USE defines the default data device. See PROG_USE as to the difference between the two defaults. The last two steps add the default devices to the filename. These defaults can be interpreted as sub-directories.

Here, a sub-directory means that where a prefix is separated by underscores, this means that the file concerned is held in the sub-directory specified by that prefix. Thus, win1_QUILL_readme_doc could be readme_doc on a hard disk in the sub-directory QUILL or doc in the sub-subdirectory readme of QUILL.

Sub-directories can be nested but the complete filename, including prefix must not be longer than 41 characters (note that if you are using a network device, for example n1_win1_proggy_bas, the maximum permitted filename length is reduced to 39 in current versions of the QL device drivers).

Examples

DATA_USE flp1_QUILL (or flp1_QUILL_)
DATA_USE MDV2_
DATA_USE win1_Psion_ARCHIVE
DATA_USE n2_ram1_
DATA_USE mdv3_games_arcade_invaders_

NOTE 1

If there is no underscore at the end of DATA_USE’s parameter, it will be added automatically.

NOTE 2

A few programs do work with these sub-directories (if Toolkit II is present), but most do not. To make any program work with them, you can fool them so that they believe that for instance FLP1_games_BOOT is FLP1_BOOT or BOOT (default device FLP1_games): See the PTH_… and DEV_… commands.

NOTE 3

Toolkit II sub-directories should not be mixed up with wild cards. DATA_USE flp1__bas makes WDIR list all BASIC programs on floppy 1, but after PROG_USE flp1__bas, SAVE test will not save the current program as flp1_test_bas but as flp1__bas_test.

NOTE 4

The default device is the current sub-directory on level-2 drivers.

NOTE 5

If you wish to turn off this feature, you can assign a null string (“”) to DATA_USE.

NOTE 6

The default devices cannot exceed 32 characters (plus a final underscore) - any attempt to assign a longer string will result in the error ‘Bad Parameter’ (error -15).

CROSS-REFERENCE

DATAD$ contains the default data device, DLIST lists all default devices. DDOWN, DUP and DNEXT allow you to skip from sub-directory to sub-directory, climb up the tree and much more. PROG_USE changes the default program device, and SPL_USE /DEST_USE the default destination device. See also DEV_USE and PTH_ADD for path search.