main() { int db, nField, nStartOffset, nEndOffset, nNextOffset; text pszNewField; /* Make sure the database is open */ if (db.database <> "") { /* Get the field */ if ((nField = GetField(db, nField)) > 0) { /* Cycle through the database */ cycle(db) { /* Put up a status message */ puts(0, 0, "Processing document " + str(docno(db)) + " of " + str(count(db)) + "."); /* Reset the variables */ pszNewField = ""; nStartOffset = 1; /* Now loop through and look for angle brackets */ while (nEndOffset = match(db->nField, "<", nStartOffset)) { /* Now look for the ending bracket */ if (nNextOffset = match(db->nField, ">", nEndOffset + 1)) { /* Concatenate the the text before the brackets */ pszNewField = pszNewField + substr(db->nField, nStartOffset, nEndOffset - nStartOffset); /* Set the new starting offset */ nStartOffset = nNextOffset + 1; } else { /* Don't continue at this point */ break; } } /* Now append the rest of the field */ pszNewField = pszNewField + substr(db->nField, nStartOffset); /* Now save the field */ db->nField = pszNewField; } } } } /**************************************************************** * Name: GetField * * Synopsis: Prompt user for field name. * ****************************************************************/ GetField(int db, next) { int i, n; text field[101]; text screen; if (db.documents >= 0) { field[0] = "Field Type "; for(i = 1; i <= db.fields; i = i +1) switch(db.type[i]) { case 'T' : field[i] = pad(db.name[i],'L',13)+ "Text "; case 'P' : field[i] = pad(db.name[i],'L',13)+ "Paragraph"; case 'N' : field[i] = pad(db.name[i],'L',13)+ "Numeric "; case 'D' : field[i] = pad(db.name[i],'L',13)+ "Date "; } i = db.fields + 1; screen = save(11,30,21,57); while(i > db.fields) i = menu(11, 30, 21, 57, field, next,""); restore(11,30,screen); if (i) next = i; } return(next); } /* GetField() */