Generate Definition File utility
The Generate Definition File utility generates a definition file from a repository structure. This file can be .INCLUDEd in your program, and so is often referred to as an “.INCLUDE file”. You can also .INCLUDE directly from the repository; see the .INCLUDE directive for more information.
When generating a definition file, fields are generated by name, with the exception of fields that have been designated as Excluded by Language, which are generated as unnamed fields of a given size. (Excluded overlay fields are not generated.)
If any group definitions include a member prefix specification and the Use by compiler flag is set, the prefix is included when the members of that group are generated.
1. | Select Utilities > Generate Definition File. The default repository filenames displayed are determined by the logic discussed in Determining the repository files used. |
|
2. | Enter data in each field as instructed below. |
Repository main file
Enter or select the name of the repository main file from which a definition file should be generated.
Repository text file
Enter or select the name of the repository text file from which a definition file should be generated.
Structure name
Enter the name of the structure for which you want to generate a definition. The file will contain only the definition of this structure, but you can generate definition files for other structures and append them to create a single file containing multiple definitions; see step 3 below.
INCLUDE file
Enter a name for the .INCLUDE file into which the definition will be generated. If you don’t specify an extension, it defaults to .def. By default, the file is created in the current working directory.
Header type
Select the header type for the record definition :
Record = Definition is a local record or global data structure. (default)
Common = Definition is a shared data record.
None = Definition has no header.
If you select None, the cursor moves to the Prefix string field.
Header name
If you selected Record or Common for the header type and want the definition to be named, enter the name here.
Overlay
Set Overlay to indicate that the definition is to be a record overlay. When the definition is created, “,X” will follow the header. The header type must be Record or Common if you specify an overlay.
Prefix string
Enter a string that will prefix each field definition. You can use different prefix strings to distinguish fields from the same structure in different definition files (since Synergy DBL does not permit two fields to have the same name).
Record offsets
Set Record offsets to include record offsets in the field comments. By default, Record offsets is set.
GLOBAL statement
Set this option to precede the record definition with the Synergy DBL GLOBAL statement.
DATA, SECTION, INIT
If GLOBAL statement is set, you can include up to three optional keywords in the GLOBAL statement. The DATA and SECTION keywords do not affect the function of the GLOBAL statement, although you might want to include them for clarity. The INIT keyword enables you to declare initial values within the global data area.
Here’s how the optional keywords will appear in the GLOBAL statement:
GLOBAL [DATA] [SECTION] name [,INIT]
GLOBAL name
If GLOBAL statement is set, enter a name to identify the global section.
ENDGLOBAL statement
Set this option to follow the record definition with the ENDGLOBAL statement. If GLOBAL statement is set, this option is selected automatically, but you can clear the check box if desired. For example, you would want to clear this field if you were appending a record definition to an existing file.
3. | Exit the window to generate the definition. |
If the filename that you specified in the INCLUDE file field already exists, you are prompted
Cannot create file filename. File already exists. Select “No” to append output to the existing file; “Yes” to delete it.
Select Yes to overwrite the existing file with the new definition. Select No to append the definition to the existing file. Select Cancel to return to the INCLUDE file field and enter another filename. When processing is complete, you are returned to the Utilities menu.
Examples
The file below is an example of a definition file that was generated by Repository.
; Structure : CUSTOMER ; File Type : DBL ISAM ; Creation Date : 24-FEB-2009, 10:00:56 ; Description : Customer master file ; Record Size : 146 ; # of Files : 1 ; # of Fields : 10 ; # of Keys : 2 ; # of Relations : 2 GLOBAL DATA SECTION cust record cust_master CM_CUST_ID ,D6 ; (1,6) Customer ID CM_CUST_NAME ,A30 ; (7,36) Cust name CM_SALES_REP ,D3 ; (37,39) Sales rep ID CM_CUST_CONT ,A25 ; (40,64) Main contact CM_ADDRESS ,A40 ; (65,104) Address CM_CITY ,A15 ; (105,119) City CM_STATE ,A2 ; (120,121) State CM_ZIP ,A10 ; (122,131) Zip code CM_MAILADR ,A67 @CM_ADDRESS ; (65,131) Mail address CM_PHONE ,A15 ; (132,146) Telephone # ENDGLOBAL
All date and time fields are stored as decimal and are indicated accordingly in the generated file. (For example, a DT8 field is generated as D8 in the definition file.) All user type fields (for example, U6) are generated as alpha (for example, A6). |
Loading fields from a definition file
In addition to generating a definition file from a defined structure, Repository also enables you to do the reverse: generate repository entries from a definition file. See Loading fields from a definition file.