Subject: | |
From: | |
Reply To: | Wyman, Alan |
Date: | Fri, 3 Mar 2000 12:26:06 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
What I have done is use your favorite editor or even Suprtool to change the
flat file of updates into a record that looks like the following:
CHAIN datasetname FRUITNAME=keyvalue;UPDATE;EXTRACT PRICE=newprice;XEQ
Then 'USE' the edited file in Suprtool to update your records. It ends up
using DBGET instead of the faster Suprtool MR,NOBUF methods but it gets the
job done accurately.
Alan Wyman
Programming Manager - Information Systems
Alliant Foodservice - Minneapolis
2864 Eagandale Boulevard
Eagan, MN 55121
(651) 683-4253
(651) 683-4438 fax
e-mail: [log in to unmask] <mailto:[log in to unmask]>
-----Original Message-----
From: Martin Knott [SMTP:[log in to unmask]]
Sent: Friday, March 03, 2000 11:55 AM
To: [log in to unmask]
Subject: using SUPRTOOL to update a dataset with different
values
I can't think of a good way to explain the problem so I'll try to
illustrate
with a trivial example.
I have a dataset of fruit and vegetables with a price for each,
keyed on
fruitname thus:
FRUITNAME PRICE
-------- -------
APPLE 20
BANANA 30
PEAR 35
POTATO 25
CARROT 25
ONION 40
I also have a flat file of new prices:
BANANA 35
CARROT 20
ONION 15 ( it was a bumper year for onions)
How can I apply the new values in the flat file to the dataset.
I guess my question boils down to: Can I use a flat file of key
values and
an associated data field to update a dataset?
My first thought was to EXTRACT out the records for BANANA, CARROT,
and
ONION, then LINK this flat file to the data, then delete the
original
records then PUT the entire flat file back to the dataset. My next
idea was
to read each line of the data into VARs then run a SUPRTOOL routine
for each
line along the lines of:
...
...
UPDATE
IF FRUITNAME=!DATA_FRUIT
EXT PRICE=!DATA_PRICE
....
Both these methods seem a bit long winded. Any thoughts or ideas
would be
appreciated (any orders for kiwi fruit will be ignored)
thanks in advance ( and in retrospect for the people who helped out
with a
PCL question last month)
martin
|
|
|