dfgetsz_max: Get maximum size for current file
Use this function to get the maximum size that is allowed for a large logical record (LLR) in the specified file.
Last updated
Added for PUT11.
Format
unsigned int dfgetsz_max(dft_fil *file); - file
- is a pointer to the base address of the SW00SR slot of the file that you want to access and is returned by the dfopn function. The SW00SR slot is defined in the c_sw00sr.h header file.
Entry requirements
None.
Return conditions
The maximum size that is allowed for an LREC in the specified file.
Error return
None.
Programming considerations
- The type definitions are defined in the c_cdfapi.h header file.
For example,
dft_fil,dft_ref, anddft_kyl. - The maximum size for an LLR on your system is specified by the customizable #LLRMLR equate in the ACPDBE macro. For any particular file, you can override this value and use a higher or lower maximum LLR value by specifying the MAXLLR parameter on the DBDEF macro.
Examples
The following example gets the
maximum LLR size that is allowed for the file and adds an LLR with
that size.
dft_fil *file_ptr;
char *llr_ptr;
unsigned int maxsize;
dft_bam bam_parameters;
dft_bam *bam_parameters_ptr = &bam_parameters;
file_ptr = dfopn("GR00DF", GR00DFI, DFOPN_HOLD);
maxsize = dfgets_max(file_ptr); // request max size
llr_ptr = (char *)malloc(maxsize); // get heap for LLR
if (llr_ptr) {
set_up_llr_data(llr_ptr); // set up data for LLR
bam_parameters_ptr->buf_ptr = llr_ptr;
bam_parameters_ptr->buf_siz = NULL;
bam_parameters_ptr->lrec_siz = &maxsize;
dfsetbam(file_ptr, bam_parameters_ptr); // set up bam parameters
rec_ptr = dfadd(file_ptr, DFADD_NEWLREC, DFADD_BAM, NULL); // add LLR
}
else {
... // allocation error
}