Files and subfiles
Most of the macros and functions operate on logical records (LRECs) in a subfile. Some macros and functions operate on one or more subfiles, and some on whole files.
When you call a C function, you identify the subfile you want to access by providing a pointer to the SW00SR slot created when you call the dfopn function. When you call a macro, you identify the file you want to access by its DSECT name and you specify the subfile by using the ALG, FILE, or ORD parameter.
The TPFDF product provides you with two mechanisms for accessing LRECs.
- For the most commonly used mechanism, TPFDF acquires the storage into which the 4-K file block that contains the LREC is read. You are then provided a pointer to the requested LREC in the 4-K block, and it is the responsibility of your application program to maintain the integrity of the LREC. This mechanism works only for an LREC that can fit into a single 4-K file block.
- The second mechanism, called buffered access mode (BAM), requires that you provide the storage for the LREC. The TPFDF product moves a copy of the LREC from the file block in storage that it manages into the storage buffer that you acquired. Your application program then works with a copy of the LREC. TPFDF maintains control of the actual LREC that is in the file. This mechanism allows you to work with LRECs that are too large to fit in a single 4-K file block.
The BAM mechanism for accessing LRECs is supported only for the following macros and functions:
- DBADD
- DBRED
- DBREP
- dfadd
- dfred
- dfrep.