Creating a New Data Source: The CREATE Command

How to:

You can create a new, empty FOCUS data source for a Master File using the CREATE command. You can also use the CREATE command to erase the data in an existing FOCUS data source.

The CREATE command also works, with the appropriate data adapter installed, for a relational table (such as a DB2 or Teradata table). For information, see the documentation for the relevant data adapter.

If you issue the CREATE FILE command when the data source already exists, the following message appears for a FOCUS or XFOCUS data source:

(FOC441) WARNING. THE FILE EXISTS ALREADY. CREATE WILL WRITE OVER IT. 
REPLY:

The DROP option on the CREATE FILE command prevents the display of the message and creates the data source, dropping the existing table first, if necessary, and re-parsing the Master File if it changed.

Note that on z/OS, you must issue either an allocation or a CREATE command for a new data source. For all other platforms, if the data source has not been initialized, a CREATE is automatically issued on the first MODIFY or Maintain Data request made against the data source.

Syntax: How to Use the CREATE Command

CREATE FILE mastername [DROP]

where:

mastername

Is the name of the Master File that describes the data source.

DROP

Drops an existing file before performing the CREATE and re-parses the Master File, if necessary. No warning messages are generated.

If you issue the CREATE FILE filename DROP command for a FOCUS or XFOCUS data source that has an external index or MDI, you must REBUILD the index after creating the data source.

Note the following when issuing CREATE on z/OS:

  • If you do not allocate the data source prior to issuing the CREATE command, the data source is created as a temporary data set. To retain the data source, copy it to a permanent data set with the DYNAM COPY command.
  • The CREATE command preformats the primary space allocation and initializes the data source entry in the File Directory Table. A Master File must exist for the data source in a PDS allocated to ddname MASTER.
  • Issuing MODIFY or Maintain commands against data sources for which no CREATE or allocation was issued results in a read error.

After you enter the CREATE command, the following appears:

NEW FILE name ON date AT time

where:

name

Is the complete name of the new data source.

ON date AT time

Is the date and time at which the data source was created or recreated.

When you issue the CREATE command without the DROP option, if the data source already exists, the following message appears:

(FOC441) WARNING. THE FILE EXISTS ALREADY. CREATE WILL WRITE OVER IT. 
REPLY:

To erase the data source and create a new, empty data source, enter Y. To cancel the command and leave the data source intact, enter END, QUIT, or N.

If you wish to give the data source absolute File Integrity protection, issue the following command prior to the CREATE command:

SET SHADOW=ON

Example: Recreating a FOCUS Data Source in Windows

To recreate the EMPLOYEE data source, issue the following command:

CREATE FILE EMPLOYEE

The following message appears:

(FOC441) WARNING. THE FILE EXISTS ALREADY. CREATE WILL WRITE OVER IT 
REPLY:

You would reply:

YES

The following message appears:

NEW FILE C:EMPLOYEE.FOC     ON 01/03/2003 AT 15.48.57

The EMPLOYEE data source still exists on disk, but it contains no records.