Global Variables
In every CC main program, there are several variables, which are declared GLOBAL (which is actually an empty definition) and are assumed to be located and initailised in the application program for the purpose of dictating to the main program, the files to open and memory to allocated. The task of writing the application is simplified as the task may be performed without having to worry about the housekeeping aspects.
Some of these variables are
1. TEXT *recbuf[]; an array of pointers to record buffers.
2. TEXT *ifile[]; an array of names of index files to open.
3. TEXT *dfile[]; an array of names of data files to open.
4. struct s_ifdblk ifdb[]; an array of file descriptor structures to hold file descriptor information for all the index files to be opened.
5. struct s_fdblk fdb[]; an array of file descriptor structures to hold file descriptor information for all the data files to be opened.
By specifying filenames in ifile, these indices are opened in the array of file descriptors ifdb[], declared to be of size n, where n is the number of indices specified in ifile[].
For example, by declaring
TEXT *ifile[] = { "cred.idx", "stock.idx", NULL};
struct s_ifdblk ifdb[2] = {0};The two index files are opened and the file descriptor information is loaded into the ifdb array with ifdb[0] holding information on the first file, ifdb[1] holding information on the second file, etc.
