How to update record from input file

csurfer

New Member
I have to update several thousand existing records (one field only) in our database, I’d like to be able to do this without having to go manually to each record.

I know how to load new (create) records from an import file (import.d) but this is of no use for our requirement.

I write a quick update routine from the progress editor.

Example of data file:

The Price field is what needs to be updated.

Prodno. Price

465646568 25.6898
478568588 52.5852
568985486 555.5556

The routine simply needs to find the Prodno in the database table and update that record with the associated price amount.

Using: Progress, Procedure Editor Release 10.4
Linux AS release 4
Database that is being updated is SX enterprise Version 6.0.040

Any help would be greatly appreciated.
 
Hi.

DEF VAR t_item AS DEC.
DEF VAR t_price AS DEC.
INPUT FROM 'your_file.txt'.
REPEAT :
IMPORT DELIMITER " " t_item t_price.
FIND articulo WHERE
articulo.id_articulo = t_item NO-ERROR.
IF NOT AVAILABLE articulo THEN NEXT.
articulo.precio = t_price.
END.

Mrobles
 
Thank you very much!

That did the trick. Saved the girls several hours, not to mention the keying errors that would have been introduced. :)
 
Back
Top