home *** CD-ROM | disk | FTP | other *** search
- {****************************************************************************
- How to turn the fix skeleton into a "post to all records" skeleton.
-
- This is specifically coded to work with the CASHBOOK tutorial, but the idea
- could be followed through for any particular database.
-
- Into a function file, PROCESS.FUN, write the following code :--
-
-
-
- string newAmount;
-
- void getUserInput(void)
- /*
- Get some user input.
- */
- {
- strcy(newAmount," 0.00"); /* MUST BE SAME LENGTH AS "TOT_CHECKS" */
- dbgetstr(newAmount,_Num,
- "Enter the 'Total Checks' amount to be posted to every account",
- newAmount,"7#.2#","",nocheck,nohelp);
- /* USE THE SAME PICTURE AS TOT_CHECKS */
- strcpy(re_write_data,"Y");
- }
-
- bool additionalOK(void)
- /*
- Set Additional conditions therefore casuing records not conforming to
- these conditions to be deleted
- */
- {
- bool fval;
-
- fval = True; /* No extra conditions in this case */
- return(fval);
- }
-
- void setFields(void)
- /*
- Set certain field values, possibly based on conditional statements,
- to values, possibly obtained during "GetUserInput";
-
- Make sure that the data put into the fields exactly matches the length
- and picture of that field.
- */
- {
- if (filno == 1) Strcpy(CASHBOOK1.TOT_CHECKS,NewAmount);
- }
-
-
-
- Now make the following modifications to the skeleton :--
-
- 1) Directly before the line ⁿFUNCMOD" add the line /**/#include "process.fun";
- ie :--
-
- /**/#include "process.fun";
- ⁿFUNCMODⁿ
-
-
- 2) In the function "addarec()" add, as the first statement after the
- "{", /**/setFields(); ie:--
-
- void addarec(void)
- {
- /**/setFields();
- cpy_cnt++;
- switch (filno) {
- ⁿFIXADDRECⁿ
- }
- }
-
-
- 3) In the body of the main program block comment out the line pick_files();
- and add in a call to getUserInput() ie :--
-
- /**//* pick_files(); */
- /**/getUserInput();
-
-
- 4) In the body of the main program block, just after the ⁿSETOKⁿ macro
- add in the line /**/ok = ok && additionalOK(); ie:--
-
- switch (filno) {
- ⁿSETOKⁿ
- };
- (**) ok = ok && additionalOK();
- if (ok) {
-
- ****************************************************************************}
-