4 Modifying the Database

Replacing Entries

If you would like to change the value of one or more data items in the database, you must first copy the data item(s) into the workfile using the FIND command. Then, you can execute Query's REPLACE command to modify the value(s):

REPLACE item list

The item list is a list of data items whose values are to be changed. All the data items must be in the same data set. If a data set name is supplied in item list, Query assumes that every data item in the data set is to be modified.

NOTE: The REPLACE command cannot modify the value of a key item. If the item list contains a key item, Query redisplays the command and item list, positioning an error message and pointer under the key item.

One data item at a time, Query displays the name of each data item and that item's current value. To change the data item's value, type the new value and then press RETURN; if you want the data item to retain its current value, simply press RETURN. If while replacing entries you make a mistake and want to start again, press the EXIT softkey. Pressing the EXIT softkey while the REPLACE command is executing causes Query to ignore all modifications to the data entry currently being accessed.

For example, when introducing the ADD command earlier in this section, ORDER_NO 250 was added to the OPTION data set; the values for OPTION_DESC, OPTION_PRICE and OPTION_TYPE were not entered. To change the values from null, first find the entry and then use the REPLACE command, as shown in the following example:

   FIND OPTION FOR OPTION.ORDER_NO="250"
   **  1 entry found.
   REPLACE OPTION_DESC,OPTION_PRICE,OPTION_TYPE

   OPTION
   OPTION_DESC =
   Light
   OPTION_PRICE =
   75
   OPTION_TYPE =
   0
In this example, only one entry was found. Query then prompted for each data item specified with the REPLACE command. If more than one entry would have been found in the workfile, Query would have prompted for each data item of each entry until either all the entries were modified or the EXIT softkey was pressed.

NOTE: If there is more than one data entry in the workfile, the order in which Query prompts for the items is the same as the order in which the data entries were placed in the workfile.


Eloquence Query Manual - 19 DEC 2002