bdfp1m15 | Programming Concepts and Reference |
Use this group of functions to create a new subfile, an empty pool subfile, or an empty indexed pool subfile with its corresponding index file. You can subsequently add logical records (LRECs) to the empty detail subfile as required.
Format
dft_hdr *dfcre(dft_fil *file, dft_opt options);
dft_hdr *dfcre_alg(dft_fil *file, dft_opt options, dft_alg *alg);
dft_hdr *dfcre_alg_pth_all(dft_fil *file, dft_opt options, dft_alg *alg);
dft_hdr *dfcre_alg_pth(dft_fil *file, dft_opt options, dft_alg *alg dft_pth pth);
|
The TPFDF product uses the algorithm argument to determine the subfile (ordinal number) that is to be accessed. Specify the algorithm argument based on the type of algorithm that is defined in the DSECT or DBDEF macro for the file. If the DSECT or DBDEF macro defines the #TPFDB04 or the #TPFDB0D algorithm, do not use this parameter.
If the subfile you are accessing is contained in a detail file or intermediate index file defined with the #TPFDBFF algorithm, the TPFDF product uses the algorithm argument to locate the subfile. See TPFDF Database Administration for more information about how the TPFDF product uses the algorithm argument to locate the subfile.
If you have supplied an algorithm argument when you opened the subfile (using a dfopn function), you can use DFCRE_INDEX with the dfcre function. If not, you must use the dfcre_alg function and supply an algorithm argument in the alg parameter.
If you specify this value, the algorithm defined for the new subfile must be #TPFDBFF.
See TPFDF Database Administration for more information about path indexes.
Entry Requirements
None.
Normal Return
A pointer to the main storage address of the header of the prime block of the created subfile.
Error Return
See Identifying Return Indicators and Errors for information about how to check the error indicators.
Programming Considerations
Alternatively, you can call dfcre before you add an LREC to a subfile to create the subfile if it does not already exist.
Examples
The following example creates a new indexed subfile using the algorithm argument member_number.
dft_fil *file_ptr; char member_number[10];
·
·
·
(void)dfcre_alg(file_ptr, 0, member_number);
Related Functions