bdfp1m1k | Programming Concepts and Reference |
Use this group of functions to retain the file address and displacement in
a block of the current logical record (LREC). You can read the LREC
later in your application program by using a dfred function with
the appropriate option parameter value.
Format
void dfret(dft_fil *file, dft_opt options);
void dfret_stk(dft_fil *file, dft_opt stk_type,
dft_opt options, dft_xxx stk);
- 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.
- options
- are the processing options for this function. Use the following
values:
- DFRET_CURRENT
- specifies that you want to retain the current LREC.
- 0
- specifies that you do not want to use any processing options.
- stk
- is one of the following based on the value you specify for the
stk_type parameter:
- A stack reference number (type dft_srn) if the
stk_type parameter is set to DFRET_STACKREF.
- A pointer to a stack area (type dft_stk) if the
stk_type parameter is set to DFRET_STACK.
- stk_type
- is one of the following:
- DFRET_STACK
- specifies that you are supplying a pointer to a stack area in the
stk parameter.
- DFRET_STACKREF
- specifies that you are supplying a stack reference number in the
stk parameter.
Both values let you retain a number of LRECs and identify them so that you
can later read them with dfred functions.
Entry Requirements
Before using this function, you must open the subfile using the DFOPN_DETAC
or DFOPN_HOLD values for the options parameter of the
dfopn function.
Normal Return
None.
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.
- Some parameters can be of different types based on the value you
specify for that parameter or a related parameter. In the function
format, the type of these parameters is shown as
dft_xxx. See the description of the specific
parameter for information about what type definition to use for that
parameter.
- To ensure an LREC is retrieved accurately when you use the
dfred function, do not use the dfret function with the
DFRET_STACK and DFRET_STACKREF values specified on the same open file.
If you do, the wrong LREC could be retrieved. You must close and reopen
the file each time you alternate between specifying the DFRET_STACK and
DFRET_STACKREF values.
Examples
- The following example retains the current LREC.
dft_fil *file_ptr;
·
·
·
dfret(file_ptr, DFRET_CURRENT);
- The following example retains the current LREC with a reference number of
100.
dft_fil *file_ptr;
·
·
·
dfret_stk(file_ptr, DFRET_STACKREF, DFRET_CURRENT, 100);
Related Functions
dfred-Read a Logical Record.