bdfp1m1j | Programming Concepts and Reference |
Use this group of functions to replace the following:
- A previously read logical record (LREC) with a new LREC
- The userLREC in the current extended LREC with a new userLREC
- The subLREC in the current extended LREC with a new subLREC.
Format
dft_rec *dfrep(dft_fil *file, dft_rec *rcd);
dft_rec *dfrep_sub(dft_fil *file, dft_rec *sub);
dft_rec *dfrep_usr(dft_fil *file, dft_rec usr);
dft_rec *dfrep_usr_sub(dft_fil *file, dft_rec *sub,
dft_rec *usr);
- file
- is a pointer to the base address of the SW00SR slot (defined in
c$sw00sr.h) of the subfile that you want to access
and is returned by the dfopn function.
- rcd
- is a pointer to the replacement LREC.
- sub
- is a pointer to the subLREC that is to replace the subLREC already in the
extended LREC.
- usr
- is a pointer to the userLREC that is to replace the userLREC already in
the extended LREC.
Entry Requirements
Before using the dfrep_sub, dfrep_usr, or
dfrep_usr_sub function, you must use a dfred
function to locate the extended LREC in which you want to replace a subLREC or
userLREC.
Normal Return
One of the following:
- Pointer to the new LREC.
- Pointer to the extended LREC containing the new subLREC, the new userLREC,
or both.
Error Return
See Identifying Return Indicators and Errors for information about how to check the error
indicators.
Programming Considerations
- The type definitions (for example, dft_fil,
dft_ref, and dft_kyl) are defined in the
c$cdfapi.h header file.
- The dfrep function replaces the current LREC; that is, the
dfrep function does not perform an internal dfred
function.
- The new LREC can be larger, smaller, or the same size as the old LREC (if
you have defined variable-length LRECs in the DSECT).
- If the subfile uses block index support, the TPFDF product automatically
updates the block index when you replace an LREC.
- Do not use the dfrep function if you have changed:
- Any key fields
- Any fields in the LREC that are also used as index key fields.
Instead, delete the old LREC with a dfdel function and add a
new LREC with a dfadd function.
- When using a dfrep function that allows a sub
parameter the current extended LREC must contain one (and only one)
subLREC. When an extended LREC contains more than one subLREC, use
dfdel_sub to delete one or more subLRECs then call a
dfadd function that allows a sub parameter to add each new
subLREC.
Examples
- The following example replaces an existing LREC with the LREC pointed to
by rec_ptr.
dft_fil *file_ptr;
·
·
·
(void) dfrep(file_ptr, DFREP_NEWLREC, &rec_ptr);
- The following example replaces the userLREC and the (one) subLREC in the
current extended LREC with a new userLREC and a new subLREC
respectively.
dft_fil *file_ptr;
struct zzzzz1 new_userlrec;
struct zzzzz2 new_sublrec;
·
·
·
dfrep_usr_sub(file_ptr, &new_userlrec, &new_sublrec);
Related Functions