bdfp1m1v | Programming Concepts and Reference |
Use the following functions to access the database definition (DBDEF)
tables.
Format
SW02SR_PTR dftab(dft_opt opt,
dft_fid *id_ptr, dft_fvn fvn,
dft_rct rct, SW02SR_PTR dfssu_ptr);
SW02SR_PTR dftab_id(dft_fid *id_ptr,
dft_fvn fvn, SW02SR_PTR dfssu_ptr);
SW02SR_PTR dftab_rct(dft_rct rct,
SW02SR_PTR dfssu_ptr);
SW02SR_PTR dftab_base();
- opt
- is the processing option. Use one of the following values:
- DFTAB_ID
- locates the database definition (DBDEF) table for the specified file
identifier (ID). If you specify this value, specify 0 for the
rct parameter.
- DFTAB_RCT
- locates the DBDEF table for the specified record type. Record types
are numeric values defined in the TPF SYSEQC macro or ALCS DXCURID
macro. If you specify this value, specify NULL for the id_ptr
parameter and 0 for the fvn parameter.
- DFTAB_BASE
- locates the base of the DBDEF index table. If you specify this
value, specify NULL for the id_ptr parameter and 0 for the
fvn and rct parameters.
- id_ptr
- is a pointer to a 2-byte field containing the file ID.
- fvn
- is the file version number.
- rct
- is the record type.
- dfssu_ptr
- is a pointer to a work area for subsystem user (SSU) information.
This applies only to a multiple database function (MDBF) environment in a TPF
system. The work area must be at least 381 bytes.
If you do not have an MDBF environment, specify NULL for this
parameter.
Entry Requirements
None.
Normal Return
- If you specify the dftab_id function or the DFTAB_ID value,
a pointer to the DBDEF table for this file ID and file version number is
returned.
- If you specify the dftab_rct function or the DFTAB_RCT value
a pointer to the DBDEF table for this record type is returned.
- If you specify the dftab_base function or the DFTAB_BASE
value a pointer to the DBDEF index table is returned.
Error Return
NULL.
Programming Considerations
You can use the dftab function with the appropriate value
specified for the opt parameter or you can use the
dftab_id, dftab_rct, or dftab_base
function to accomplish the same task.
Examples
The following code checks the existence of database definitions with a file
ID of AB in a non-MDBF environment.
#include <c$cdf.h>
if (dftab_id("AB",0,NULL) == NULL) {
wtopc_text("ID not defined in DBDEF");
}
Related Functions
None.