HP 3000 Manuals

UPDATE REPLACE [ QUERY/V Reference Manual ] MPE/iX 5.0 Documentation


QUERY/V Reference Manual

UPDATE REPLACE 

Modifies the value of data items.

Syntax 

{U[PDATE] REPLACE,}
{REPL[ACE],       } data item name [(subscript)] = "value";

[data item name [(subscript)] = "value";]...  END

For example:

     >UPDATE REPLACE,DATE="741010";END

Where data item name = DATE and value = "741010"

Parameters 

data item name         is the name of a simple data item, or the name of
                       a compound data item with an optional subscript 
                       parameter, contained in the entries selected by
                       the last FIND command.

"value"                is the new value for the data item surrounded by
                       quotation marks.  It must be the proper size and
                       type for the named item.  Quotation marks are
                       required.  QUERY prints an error message if values
                       of improper size or type are entered.

subscript              is the number indicating which sub-item you want
                       to replace.  Subscript is entered with parenthesis
                       and must be an integer > 1 and <= the number of
                       sub-items defined for the compound item.  QUERY
                       will default to the first sub-item if no subscript 
                       is specified.

Discussion 

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 OF Y ENTRIES REPLACED

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:

     >UPDATE REPLACE, 
     >>DATE="851010"; 
     >>HOURS="4"; 
     >>END 
     >

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.

Null Values 

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:

     WHAT IS THE VALUE OF data item name 
     >>

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.

Examples 

Example 1 

     >F CUSTOMER.FIRST-NAME=GENEVA 
     USING SERIAL READ
     1  ENTRIES QUALIFIED
     >REPL,STREET-ADDRESS="868 DOYLE ROAD"; 
     >>END 
     >LIST CUSTOMER FOR FIRST NAME=GENEVA 

        ACCOUNT  LAST-NAME         FIRST-NAME  IN   STREET-ADDRESS

       10034764  SLATER            GENEVA           868 DOYLE ROAD

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 

     >AD SALES 
     ACCOUNT         =>>67795400 
     STOCK#          =>>1169331 
     QUANTITY        =>>6 
     PRICE           =>>1800 
     TAX             =>>RETURN 
     TOTAL           =>>RETURN 
     PURCH-DATE      =>>121585 
     DELIV-DATE      =>>121685 

     ACCOUNT         =>>// 
     >F SALES.ACCOUNT IS 67795400 
     1  ENTRIES QUALIFIED
     >UPDATE REPLACE, 
     >>TAX="25"; 
     >>TOTAL="1825"; 
     >>END 

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 

     >FIND PRODUCT.STOCK# IGT 70000000 
     USING SERIAL READ
     3  ENTRIES QUALIFIED
     >UPDATE REPLACE, 
     >>DESCRIPTION="OBSOLETE"; 
     >>END 

     >REPORT ALL 

     STOCK#          =7931Z22F
     DESCRIPTION     =OBSOLETE

     STOCK#          =78787878
     DESCRIPTION     =OBSOLETE

     STOCK#          =98989898
     DESCRIPTION     =OBSOLETE

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.



MPE/iX 5.0 Documentation