|
|
QUERY/V Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 QUERY/V COMMANDSUPDATE REPLACE |
|
Modifies the value of data items.
For example:
Where data item name = DATE and value = "741010"''
UPDATE REPLACE is an extension of the retrieval commands in that it operates on data entries selected by the previous retrieval command. All of the data entries selected must be from the same set. UPDATE REPLACE can only be used following a FIND or FIND ALL command or a SUBSET command following a FIND or FIND ALL command. Entering a FIND CHAIN or MULTIFIND command (which selects entries from a detail set and one or more master data sets) followed by an UPDATE REPLACE command is not allowed. You must have specified a mode of 1, 2, 3, or 4 to use this command. QUERY does not allow you to modify items in the data base defined as search or sort items. The UPDATE REPLACE command consists of a series of data item name/data item value pairs separated by semicolons. When the command is entered, QUERY replaces the value of each data item named in the command with the new value enclosed in quotation marks. The names of data items appearing in the command must belong to the data entries selected by the last retrieval command. In a procedure, you must use the UPDATE REPLACE form of the command. UPDATE can be abbreviated. REPLACE cannot be abbreviated when used with the UPDATE keyword. If an IMAGE error occurs during the replacement of data entries, QUERY issues the following message to indicate how many entries were successfully updated before the error occurred:
X is the number of entries that were successfully updated, and Y is number of retrieved entries. Session Mode When you enter an UPDATE REPLACE command from a terminal, QUERY checks each line of the command as it is entered. If an error occurs, the line is ignored, an error message is sent, and you are prompted for another line. QUERY continues to prompt for lines until you enter END. END is required. The replacement statements (data item name/data item value pairs) can be entered on one line: >UPDATE REPLACE,DATE="851010";HOURS="4";END or on several lines:
Job Mode If you are entering the command in job mode, the replacement statements can appear in one record or several consecutive records. If an error occurs, either illegal data or an IMAGE error, QUERY will terminate. You can store an UPDATE REPLACE command as a procedure with null values for the data items. You do this by entering a pair of quotation marks with no intervening characters data item name= (for example, DATE=""). When such a procedure is executed using the UPDATE procedure name command, QUERY prompts you for a value by printing the message:
Where data item name is the name of the data item associated with the null value in the UPDATE REPLACE command. The desired value must be entered without quotation marks. All characters entered (including blanks, quotation marks, and other characters) are significant. The maximum number of characters which can be entered as a value is 72. Lowercase characters are upshifted unless the data item is type X. Example 1
In example 1, the CUSTOMER entry with FIRST-NAME of GENEVA is located. The street address is changed. The LIST command is used to check the results. Example 2
The UPDATE REPLACE command can also be used to fill in blank values. In the second example, no values are entered for TAX and TOTAL when the entry is added. The UPDATE REPLACE command is then used to add these values, after the entry has been located with the FIND command. Example 3
In example 3, REPORT ALL is used to verify the replacements. The entries are still available from the last FIND. Each PRODUCT data set entry with a STOCK# greater than 70000000 is changed so that the description is OBSOLETE. |
|