home *** CD-ROM | disk | FTP | other *** search
- This useful hint illustrates a procedure that would be inserted into the
- standard skeleton, (DBC.SKL), to convert a DataBoss Pascal data file into a
- DataBoss "C" data file.
-
- The idea would then be to replace the "repeat" loop in "do_menu()" with a
- call(s) to "convertPasData()" to reconfigure the data from pascal byte length
- strings to null terminated "C" strings.
-
- WARNING - Only ever run the program over the data ONCE!!. Converting a data
- more than once would corrupt the fields.
-
- This procedure would be added to a custom version of DBC.SKL just above the
- "do_menu()" function.
-
- void convertPasData(int fno, ptr fb)
- {
- byte fldlen;
- word w;
- long li;
- fldblk *fblk;
- fldtyp *ftp;
- string tpic;
- long *recstatptr;
-
- fblk = fb;
- ftp = &(*fblk->farr)[0];
- recstatptr = (long *)(ftp->faddr);
- recstatptr--;
- ok = True;
- link = No_Link;
- for (li=1; li < filelen(datf[fno]); li++) {
- recno[fno] = li;
- getarec(fno);
- if (*recstatptr == 0) {
- for (w=0; w < fblk->numf; w++) {
- ftp = &(*fblk->farr)[w];
- if (ftp->typ != _Memo) {
- expand(tpic,ftp->pic);
- fldlen = piclen(tpic,ftp->typ);
- memmove(ftp->faddr,ftp->faddr+1,fldlen);
- ftp->faddr[fldlen] = 0;
- }
- }
- putarec(fno);
- }
- }
- link = Up_N_Down;
- }
-
-
- The next step would be to remove the "repeat" loop code from within the
- "do_menu()" function and a call to the above routine could be inserted
- instead.
-
- If the Application was called "FROMPAS" then appropriate call would be :--
-
- convertPasData(1,&FROMC1.datasize);
- convertPasData(2,&FROMC2.datasize);
-
- Finally, BEFORE you attempt to run the "C" version of the database
- maintenance program run the "C" version of the "Fix" program to create
- the "C" index files for the converted data.