UPDATE ADD [ QUERY/V Reference Manual ] MPE/iX 5.0 Documentation
QUERY/V Reference Manual
UPDATE ADD
Adds data entries to a manual master or detail data set.
Syntax
{U[PDATE] ADD,}
{AD[D] } [data base name:] data set name
For example:
>UPDATE ADD,LABOR
Where data set name = LABOR
>AD PAYROLL
Where data set name = PAYROLL
Parameters
data base name is the name of a data base specified in either the
DEFINE, DATA BASE=, or MULTIDB command.
data set name is the name of a data set in the data base. The
data set must be either a manual master or detail.
You must have write access as determined by the
password you enter in response to the PASSWORD=
prompt or through the PASSWORD= command.
Discussion
When you use the UPDATE ADD command, QUERY prompts you for data item
values by printing the names of the data items. You type the desired
value following the data item name. QUERY will continue to prompt you
for data item values until you terminate the command.
In a procedure, you must use the UPDATE ADD form of the command. UPDATE
can be abbreviated. ADD cannot be abbreviated when it is used with the
UPDATE keyword.
You must have specified mode 1, 3, or 4 to use this command.
Example
>AD PRODUCT
STOCK# =>>12345678
DESCRIPTION =>>"ANTIMACASSAR"
STOCK# =>>RETURN
STOCK# =>>54231234
DESCRIPTION =>>RETURN
STOCK# =>>//
>
In the example above, the STOCK# is a search item. A value must be
provided. Since DESCRIPTION is not a search item, it can be left blank
by pressing the RETURN key. However, if you try to use RETURN for a
search item, QUERY will prompt you again for the value. The command is
terminated with two slashes.
If you are in session mode and enter a value that is too large or that
contains invalid characters, QUERY issues an error message and reprompts
with the same data item name.
If illegal data is encountered while QUERY is running in a job or from an
XEQ file, QUERY will issue an error message and stop adding data. In job
mode, QUERY will also terminate.
The UPDATE ADD command will prompt you for each sub-item (each occurrence
of a compound data item). If you want to terminate the prompting for
sub-items, enter two asterisks (**). QUERY will then prompt you for the
next item.
>UPDATE ADD,SALES
SALESPERSON =>>JONES
MONTHLY-SALES(1)=>>450
MONTHLY-SALES(2)=>>700
MONTHLY-SALES(3)=>>**
REGION =>>MIDWEST
SALESPERSON =>>//
Using Quotation Marks
Values can be entered with, or without quotation marks. When you enter U
or X type values without quotation marks, leading blanks are ignored and
the value is left-justified in the data item field. Blanks or any other
special characters are entered in the data field only if the value is
entered with quotation marks. For example, if F-NAME is a U type data
item, then:
F-NAME >> SALLY
is entered in an 8-character field as:
+---------------+
|S|A|L|L|Y| | | |
+---------------+
F-NAME >>" SALLY"
is entered in the same field as:
+---------------+
| | |S|A|L|L|Y| |
+---------------+
A U type data item is automatically upshifted if it is entered in
lowercase. You can override the upshifting by enclosing the entry in
quotation marks. In the next two examples, F-NAME is a U type data
value.
F-NAME >>sally
is entered as:
SALLY
F-NAME >>"sally"
is entered as:
sally
If quotation marks are to be included as part of the value to be entered,
they must be entered twice to avoid being confused with delimiters. For
example, the value:
ROBERT "BOB" BRUN
must be entered as:
"ROBERT ""BOB"" BRUN"
Numeric type values (all types except U and X) are always right-justified
whether entered with or without quotation marks. Numbers entered in X
type data items are always left-justified.
Null Values
Only search and sort items must have values supplied. If you do not want
to enter a value for other items, you can enter a null value. In session
mode press RETURN without any preceding characters. In job mode, supply
a blank line to indicate a null value. Numeric data items which do not
contain a value are set to zero, character items are set to blanks.
Real Number Values
Real number values can be entered as either fixed or floating point
numbers. An example of a fixed point number is:
23.45
An example of a floating point number is:
2.345E+01
The signed integer following the E stands for a power of 10 to be
multiplied by the number to the left of the E. Both examples above stand
for the same number.
Detail Data Sets
If a detail data set is linked to one or more manual master data sets,
you must know the content of the master set before you can add entries to
the detail data set. Each detail entry is associated with a master entry
through the same search item. The detail search item and the master
search item must have the same value, and the value must exist in a
master entry before it can be added to a detail data entry. If you enter
a search item value that does not exist in the master data set linked to
the detail set through that search item, QUERY prints the following error
message:
MISSING SEARCH KEY VALUE FOR data item name IN MASTER data set name
==========|ENTRY CANNOT BE ADDED|==========
Terminating UPDATE ADD
Once you have supplied values (null or otherwise) for all the data items
in the entry, QUERY begins prompting you for another entry. To continue
adding entries, merely enter an appropriate value at the prompt. To
terminate UPDATE ADD command, either enter two slashes (//) followed by
RETURN or enter CONTROL Y.
The command can be terminated at any time. However, if you want to save
the values you have entered for the current entry, do not use the CONTROL
Y or two slashes before you have been prompted for the last value of the
current entry. Normally you will terminate the command in response to
the first data item prompt in an entry.
Example
In the example below, the user tries to add an account to the SALES
detail data set, but the account is not already in the CUSTOMER master
data set. QUERY prints an error message and reprompts for data item
values. The command is terminated with two slashes. Next, the account
is added to the CUSTOMER master data set. The original entry can then be
added to the SALES detail data set. Note that dates are automatically
added to the DATE-MASTER automatic master data set.
>ADD SALES
ACCOUNT =>>86110047
STOCK# =>>14519990
QUANTITY =>>6
PRICE =>>2000
TAX =>>RETURN
TOTAL =>>RETURN
PURCH-DATE =>>121585
DELIV-DATE =>>121685
MISSING SEARCH KEY VALUE FOR ACCOUNT IN MASTER CUSTOMER
==========|ENTRY CANNOT BE ADDED|===========
ACCOUNT =>>//
>ADD CUSTOMER
ACCOUNT =>>86110047
LAST-NAME =>>CELERY
FIRST-NAME =>>ALLISON
INITIAL =>>B.
STREET-ADDRESS =>>18 ASCOTT AVE.
CITY =>>CARMEL
STATE =>>CA
ZIP =>>93921
CREDIT-RATING =>>1.2
ACCOUNT =>>//
>ADD SALES
ACCOUNT# =>>86110047
STOCK# =>>141990
QUANTITY =>>6
PRICE =>>2000
TAX =>>RETURN
TOTAL =>>RETURN
PURCH-DATE =>>121585
DELIV-DATE =>>121685
ACCOUNT =>>//
MPE/iX 5.0 Documentation