Using CREATE-FILE

To use CREATE-FILE, you must specify the following information on the command line:

The name you specify for the file must be unique in the account.

In this example of using the CREATE-FILE command, a database file named PAYROLL is created. The modulo specified for the dictionary is 3 and for the data file is 43.

> CREATE-FILE PAYROLL 3 43

[417] FILE ’PAYROLL’ CREATED;  BASE = 6762;  MODULO=3.

[417] FILE ’PAYROLL’ CREATED;  BASE = 6765;  MODULO=43.

The CREATE-FILE processor allocates disk space for the PAYROLL file and creates D-pointers in two different dictionaries. It creates an entry for the PAYROLL dictionary in the Master Dictionary, and it creates an entry for the PAYROLL data file in the PAYROLL dictionary.

When creating a database as shown in the previous example, the dictionary and the data file are in a one-to-one relationship. The dictionary and the data file have the same name. When a dictionary is shared by multiple data files, only one data file can have the same name as the dictionary.

If an existing database has a single data file, you can use CREATE-FILE to create additional data files. For example:

>CREATE-FILE DATA PAYROLL,PAYROLL.LASTYEAR 43

[417] FILE 'PAYROLL.LASTYEAR' CREATED; BASE = 6547, MODULO = 43

The DATA modifier specifies that only the data file is created (the dictionary PAYROLL already exists).

When setting up a shared dictionary, you can create the dictionary before or at the same time as you create the first data file. The following example creates the dictionary file INVOICES with a modulo of 3.

>CREATE-FILE DICT INVOICES 3

[417]  FILE 'INVOICES' CREATED; BASE = 6648, MODULO = 3

Then you create each data file. The user must supply the name of the dictionary followed by a comma, the name of the data file, and the modulo.

>CREATE-FILE DATA INVOICES,OCTOBER 3

[417]  FILE 'OCTOBER' CREATED; BASE = 6749, MODULO = 3

>CREATE-FILE DATA INVOICES,SEPTEMBER 3

[417]  FILE 'SEPTEMBER' CREATED; BASE = 6752, MODULO = 3

As a result of these commands, the INVOICES dictionary has two D-pointers to identify the data files: OCTOBER and SEPTEMBER. Additional data files can be set up at any later time as needed.

You can combine the first two commands in the previous example to create the dictionary and one of the data files at the same time.

>CREATE-FILE INVOICES,OCTOBER 3 3

[417] FILE 'INVOICES' CREATED; BASE = 11898, MODULO = 3

[417] FILE 'OCTOBER' CREATED; BASE = 11901, MODULO = 3

The above example creates the dictionary INVOICES, which has a D-pointer to the data file OCTOBER.

Note that there is no data file named INVOICES; it could be created explicitly, however.

The CREATE-FILE command may also be used to create an account. In this example of using CREATE-FILE, the account PAY is created. The system dictionary (M/DICT) is specified as the type of file being created, and the modulo specified for the account’s Master Dictionary is 3.

>CREATE-FILE M/DICT PAY 3

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

For details on the options available for CREATE-FILE, see Managing Files.

See Also

Creating a File

Selecting a File Name

Selecting a Modulo

Creating Dictionary Entries

Creating Data Items