Define() establishes specific data definitions. This involves defining columns/fields and creating the tables/files with optional indexes.
Below is the code for Define():
#ifdef PROTOTYPE
VOID Define(VOID)
#else
VOID Define()
#endif
{
printf("DEFINE\n");
/* open files */
printf("\tOpen table...\n");
custmast_filno = OpenFileWithResource(-1, "custmast.dat", 0);
if (custmast_filno < 0)
{
/* create files */
printf("\tCreate table...\n");
if (CreateIFile(&custmast_ifil))
Handle_Error("Define(): CreateIFile()", 0);
/* store record information into data file */
if (PutDODA(custmast_ifil.tfilno, custmast_doda, (UCOUNT)NBR_OF_FIELDS))
Handle_Error("Define(): PutDODA()", 0);
/* close files */
CloseIFile(&custmast_ifil);
/* open files */
custmast_filno = OpenFileWithResource(-1, "custmast.dat", 0);
if (custmast_filno < 0)
Handle_Error("Define(): OpenFileWithResource()", 0);
}
}