Creating Files

The CREATE-FILE processor can be used to create:

Format

CREATE-FILE DICT filename modulo [(options)]

Parameter(s)

filename

Valid file name that does not already exist in the account.

modulo

Prime number.

The modulo specifies the number of groups allocated for the dictionary, representing a block of contiguous frames known as the primary file space (a block of contiguous frames in the overflow area that is greater than or equal to the modulo specified for the file must be available for the file to be created). When you create a dictionary, a File Definition item is created in the Master Dictionary. This D-pointer contains the base frame ID (the frame ID of the first frame in the block) as well as the modulo.

The following example creates a dictionary named INVENTORY, allocating 3 frames for it, and placing a D-pointer of the same name in the Master Dictionary.

>CREATE-FILE DICT INVENTORY 3

[417] FILE 'INVENTORY' CREATED; BASE = 10074, MODULO = 3.

If, subsequent to the creation of the dictionary, no data file is created, the dictionary is a single-level file that contains a Q-pointer to itself. This is called a reflexive Q-pointer, containing no information in Attributes 2 and 3 of the entry.

A dictionary must exist before you create a data file.

Format

CREATE-FILE DATA [dict-name,] filename modulo [(options)]

The DATA modifier indicates that the dictionary already exists and that only the data file needs to be created. The name of the data file, if it is the same as the dictionary, and the modulo of the file are the only two required parameters. If the dictionary and data file do not have the same name, then you must also specify dict-name, the name of the dictionary.

When you create a data file, the CREATE-FILE processor allocates the data file’s primary file space. A File Definition item is created in the associated dictionary. This D-pointer identifies the data file and contains the base frame ID and modulo. The dictionary has a File Definition item for each data file that it points to.

The example below creates the data file INVENTORY, allocating a block of 373 frames for it, and placing a D-pointer of the same name in the file dictionary named INVENTORY.

>CREATE-FILE DATA INVENTORY 373

[417] FILE 'INVENTORY' CREATED; BASE = 10077, MODULO = 373.

You can also create the dictionary and the data file at the same time.

Format

CREATE-FILE [dict-name,] filename dict-modulo data-modulo [(options)]

This usage requires that you specify the modulo of the dictionary and the modulo of the data file. This form of CREATE-FILE performs in a single step the creation of the dictionary followed by the creation of the data file. If the dictionary is to be shared by multiple data files, this syntax can be used to create only the first data file. The name of the dictionary is specified only if it should not have the same name as the data file.

The next example creates a dictionary named SHIPPING, allocating 3 groups for it, and placing a D-pointer in the Master Dictionary. It also creates the data file SHIPPING, allocating 373 groups for it, and placing a D-pointer in the SHIPPING dictionary.

>CREATE-FILE SHIPPING 3 373

[417] FILE 'SHIPPING' CREATED; BASE = 10450, MODULO = 3.

[417] FILE 'SHIPPING' CREATED; BASE = 10453, MODULO = 373

The following example creates a dictionary and a data file with different names:

>CREATE-FILE PERSONNEL,DAY-SHIFT 3 37

[417] FILE 'PERSONNEL' CREATED; BASE = 10826, MODULO = 3.

[417] FILE 'DAY-SHIFT' CREATED; BASE = 10829, MODULO = 37

This command creates the dictionary PERSONNEL, allocating 3 groups for it. It also creates the data file DAY-SHIFT allocating 37 groups for it. The Master Dictionary has a D-pointer for the dictionary PERSONNEL which has the D-pointer to the data file DAY-SHIFT. (The Master Dictionary does not have any reference to DAY-SHIFT.) To create another data file associated with the PERSONNEL dictionary, you would enter:

>CREATE-FILE DATA PERSONNEL,NIGHT-SHIFT 37

[417] FILE 'NIGHT-SHIFT' CREATED; BASE = 10867, MODULO = 37

This command creates a data file named NIGHT-SHIFT, placing a D-pointer in the PERSONNEL dictionary.

You can also create an account using the CREATE-FILE command.

Format

CREATE-FILE M/DICT account-name dict-modulo [(options)]

In this example of using CREATE-FILE, the account PAY is created. The system dictionary (M/DICT) is specified, and the modulo specified for the dictionary is 3.

>CREATE-FILE M/DICT PAY 3

[417] FILE 'PAY' CREATED; BASE = 56692, MODULO = 3

For more information about the CREATE-FILE command, see CREATE-FILE Command.

See Also

Overview of File Management Commands

File Name Syntax

Item Lists

Creating mvBASIC Files

Copying a File

Clearing a File

Deleting Files

Copying File Items

Editing Items

Deleting Items