dfadr-provide the file address of a prime block
Use this group of functions to get the file address and ordinal number of a prime block in a fixed file.
You can also use a dfadr function to specify a range of ordinals to be used in subsequent fullfile processing.
Format
void dfadr_alg(dft_fil *file, df_opt options, dft_alg *alg);
void dfadr_ord(dft_fil *file, df_opt options, dft_ord ord);
void dfadr_beg(dft_fil *file, df_opt options, dft_alg *beg);
void dfadr_end(dft_fil *file, df_opt options, dft_alg *end);
void dfadr_beg_end(dft_fil *file, df_opt options, dft_alg *beg,
dft_alg *end);
- alg
- is a pointer to an algorithm argument that identifies the subfile.
- beg
- is a pointer to an algorithm argument that is used to calculate the begin ordinal of the file. This ordinal is used as the start ordinal during fullfile processing.
- end
- is a pointer to an algorithm argument that the TPFDF product uses to calculate the end ordinal of the file. This ordinal is used as the end ordinal during fullfile processing.
- file
- is a pointer to the base address of the SW00SR slot (defined in c$sw00sr.h) of the file that you want to access and is returned by the dfopn function.
- options
- are the processing options for this function. Use the following values:
- DFADR_NODUMP
- specifies that you do not want the TPFDF product to issue any of the following system errors
while processing this function:
- DB0100
- DB0102
- DB0117
- DB0123
- DB0138
- DB0140.
See TPFDF Messages (System Error, Online, Offline) for more information about these system errors.
Note: Using the DFADR_NODUMP value is not recommended because it can prevent system errors from being issued that indicate a critical problem. - DFADR_WRAPAROUND
- reads LRECs from the start of the file to the end until it has read the whole file. Use this
parameter value only when you intend to use fullfile processing.
For example, consider a file that contains five subfiles and the current subfile is number 3. If you specify DFADR_WRAPAROUND, and then call a dfred function with DFRED_FULLFILE, LRECs would be read from the subfiles in the order: 3, 4, 0, 1, 2.
- 0
- specifies that you do not want to use any processing options.
- ord
- is the ordinal number of the subfile that you want to access.
If the file is partitioned or interleaved, specify the relative ordinal number within the partition or interleave. If the file is not partitioned or interleaved, specify the file address compute program (FACE) ordinal number.
Entry requirements
None.
Normal return
- The dfadr function does not change the current LREC even if you specify a different value for the alg or ord parameter with the dfadr function from that which was used to locate the LREC.
- If you specify the alg or ord parameter, sw00wr1 (4-byte format) and sw00wr18 (8-byte format)
are set to the file address of the corresponding prime block and sw00wr2 is set to the ordinal
number of the corresponding prime block.
If you specify the beg parameter, SW00ORD is set to the ordinal number of the corresponding prime block. Otherwise, SW00ORD is set to zero and subsequent fullfile processing occurs beginning with the first ordinal in the file.
If you specify the end parameter, SW00END is set to the ordinal number of the corresponding prime block. Otherwise, SW00END is set to zero and subsequent fullfile processing occurs ending with the last ordinal in the file.
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.
- You must specify a pointer to an algorithm argument for all the
dfadr functions.
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.
- When you use the dfadr function, subsequent fullfile processing occurs in the ordinal range SW00ORD-SW00END.
Examples
- The following example finds the file address of ordinal number 3 of a file.
dft_fil *file_ptr; dft_ord Ordinal=3; · · · dfadr_ord(file_ptr,0,Ordinal); - The following example finds the file address of a subfile identified by the algorithm argument
pointed to by alg_ptr.
dft_fil *file_ptr; dft_alg *alg_ptr; · · · dfadr_alg(file_ptr,0,alg_ptr);
