gtpc2m1b | C/C++ Language Support User's Guide |
This function converts a database ordinal number (a file address reference format (FARF) format address) to a 7-byte file address in the MMCCHHR format. The name MMCCHHR displays how the address is constructed:
The 5-byte CCHHR is the same as the record ID recorded in the count area on file.
Validity checking is done by this function on a FARF file address for the following:
Format
#include <tpfio.h> unsigned int csonc(enum t_lvl level, MCHR_STRUCT_PTR file_addr);
or
#include <tpfio.h> unsigned int csonc(TPF_FA8 *fa8, MCHR_STRUCT_PTR file_addr);
Normal Return
A nonzero value.
Error Return
An integer value of zero.
Programming Considerations
Examples
In the following example, FACS is called to calculate a FARF address and convert it to a MMCCHHR address.
#include <tpfeq.h> #include <tpfio.h> #pragma linkage(FACS,TPF,N) extern void FACS(struct TPF_regs *);
·
·
·
MCHR_STRUCT mchr; struct TPF_regs regs; /* call FACS to calculate FARF address */ regs.r0 = 0; regs.r6 = (long int)"#RECTYPE"; regs.r7 = (long int)&ecbptr()->ce1fa0; FACS(®s); if (regs.r0 == 0) { /* FACS error */ } else { /* call csonc to convert FARW to MMCCHHR */ if (csonc(D0, &mchr)) { /* success */ } else { /* failure */ } }
In the following example, tpf_fac8c is called to calculate a FARF address and convert it to a MMCCHHR address.
#include <tpfeq.h> #include <tpfio.h>
·
·
·
MCHR_STRUCT mchr; TPF_FA8 fileAddr; TPF_FAC8 parms; /* call tpf_fac8c to calculate FARF address */ memcpy(parms.ifacrec, "#RECTYPE", 8); parms.ifacord=0; parms.ifactyp=IFAC8FCS; tpf_fac8c(&parms); if (parms.ifacret != TPF_FAC8_NRM) { /* FACE/FACS error */ } else { fileAddr=parms.ifacadr; /* call csonc to convert address to MMCCHHR */ if (csonc(&fileAddr, &mchr)) { /* success */ } else { /* failure */ } }
Related Information
None.