Changes the value of one or more fields in a selected record or in any or all records in a collection or record stream. Format 1 [ field-name [,...] ] MODIFY [ALL] [ USING statement-1 ] [ ] [VERIFY [USING] statement-2] [OF rse] Format 2 MODIFY [ALL] rse USING statement-1 [VERIFY [USING] statement-2]
1 – Arguments
ALL Specifies that you want to modify either all records in the CURRENT collection or all records in the record stream specified in the record selection expression (rse). field-name Specifies the name of a field in the target records you want to modify. If you specify more than one field name, use a comma to separate each field name from the next. DEC DATATRIEVE prompts you to supply a value for each field you specify. USING statement-1 Specifies a simple or compound DEC DATATRIEVE statement that assigns values to one or more fields in the target records you want to modify. This clause can also contain any other DEC DATATRIEVE statements, such as PRINT, STORE, and other MODIFY statements. VERIFY [USING] statement-2 Specifies a statement that DEC DATATRIEVE executes before modifying the target record. OF rse Is a record selection expression that forms a record stream of the records you want to modify. An OF rse clause is optional in format 1 of the MODIFY statement. In format 2, an rse without OF is required.
2 – Examples
The following example changes one field value in a selected record: DTR> READY YACHTS MODIFY DTR> FIND FAMILIES WITH FATHER = "JOHN" [2 records found] DTR> PRINT No record selected, printing whole collection. NUMBER KID FATHER MOTHER KIDS NAME AGE JOHN JULIE 2 ANN 29 JEAN 26 JOHN ELLEN 1 CHRISTOPHR 0 DTR> SELECT 1 DTR> MODIFY FATHER Enter FATHER: JON DTR> PRINT NUMBER KID FATHER MOTHER KIDS NAME AGE JON JULIE 2 ANN 29 JEAN 26 DTR> The following example makes a 10 percent increase in the price of the first five yachts. Each yacht begins and ends with a unique price, but the new price of each yacht is 10 percent greater than the old price of that same yacht. DTR> MODIFY FIRST 5 YACHTS USING PRICE = PRICE * 1.1 DTR> PRINT FIRST 5 YACHTS LENGTH OVER MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE ALBERG 37 MK II KETCH 37 20,000 12 $40,646 ALBIN 79 SLOOP 26 4,200 10 $19,690 ALBIN BALLAD SLOOP 30 7,276 10 $30,250 ALBIN VEGA SLOOP 27 5,070 08 $20,460 AMERICAN 26 SLOOP 26 4,000 08 $10,885 DTR>