Assigning structures to files
When you assign a structure to a file, you are declaring, “This data file uses this structure.” You can assign more than one structure to a file; the maximum that can be assigned is 200. A given structure can be assigned to one or more files.
The file type of the structure must match the file type of the file definition that it is assigned to. The structure must have at least one field defined. In addition, the primary keys of all structures assigned to the same file must match. (The primary key is assumed to be the first key in the list and must be an access key.) Specifically, the following key information must match:
- Key size
- Sort order
- Dups allowed flag
- Key data type
- Number of segments
- Type, position, length, and order of each segment
See Defining keys for more information.
|1.||While defining or modifying a file definition or while the filename is highlighted in the File Definitions list, select File Functions > Assign Structures. You can also click the Assign button in the File Definition window while defining or modifying a file definition.|
The Assigned Structures list displays the names of any structures currently assigned to that file.
|2.||Select Structure Functions > Add Structure.|
|3.||Complete the fields in the Assigned Structure window as instructed below:|
Enter the name of a structure to assign to the file. To display a list of available structures whose file type matches that of the file definition, select Structure Functions > List Selections and then select the structure you want to assign to the file.
Enter the table name to use for ODBC access when using xfODBC. If specified, the ODBC table name will be used as the name of the generated table for this particular file/structure combination. You can use this feature to distinguish table names when the same structure is assigned to more than one file, or you can use it to provide more descriptive names in any situation. The table name can have a maximum of 30 characters and must begin with a letter. The remaining characters can be letters, digits, underscores (_), or dollar signs ($).
|4.||Exit the window to add the structure to the list in the Assigned Structures window.|
If the primary key definition doesn’t match other assigned structures, you are prompted
Structure’s primary key does not match those of other assigned structures.
If you get this message, press Enter, and select another structure name.
|5.||After you’ve assigned a structure, you can add other structures to the list or exit the window to return to the File Definitions list.|
If you were defining or modifying a file definition when you selected Assign Structures, when you return to that input window, the Structure field contains either the name of the assigned structure (if only one is assigned to this file) or a message stating the number of structures assigned.
You can modify only the ODBC table name.
|1.||From the Assigned Structure list, highlight the structure you want to modify and press Enter.|
|2.||In the Assigned Structures window, modify the ODBC table name by typing over it and then press Enter.|
|3.||Exit the window to save your changes.|
|1.||Select File Functions > Assign Structures while defining or modifying a file definition or while the filename is highlighted in the File Definitions list.|
|2.||In the Assigned Structures list, highlight the structure you want to disassociate.|
|3.||Select Structure Functions > Delete Structure.|
|4.||At the prompt, select Yes to disassociate the structure and remove it from the list or No to cancel the deletion.|