The following statement updates salaries to conform to the new minimum wage, which is in the variable nMinWage:

replace for SALARY < nMinWage SALARY with nMinWage

The following statement gives everyone a 10% raise, and two weeks (80 hours) extra vacation:

replace all SALARY with SALARY * 1.1, VACATION with VACATION + 80

The next example replaces all instances of an inadvertently assigned duplicate customer ID number with their actual customer number.

PROCEDURE ChangeCustID( oldCust, newCust )

local cOrder 

   cOrder = order( ) 

   set order to CUST_ID 

   do while seek( oldCust ) 

      replace CUST_ID with newCust 

   enddo 

   set order to ( cOrder ) 

The routine uses the SEEK( ) function to find any records that have the old customer ID number. The number is replaced in that record only, which moves the record into its updated position in the index. This movement doesn’t matter because the loop uses the SEEK( ) function again to find another match.

The current index order is saved before the loop, and restored at the end of the routine.