The following examples illustrate the use of the UPDATE command:
Example 1—update a table
Update table TABLEXX with the data on the file identified by the DDNAME UPDFILE, removing those rows whose keys are found on DELFILE.
UPDATE TBL=TABLEXX WITH=UPDFILE REMOVE=DELFILE;
Example 2—eliminate duplicates
A file is available containing a record for each product ordered in a company. The supplier is contained in position 20 for a length of 10. A list of all suppliers on the file is required. The following code eliminates duplicate suppliers if there are multiple occurrences, prints the resulting table contents, and then deletes the temporary table.
DEFINE TBL=SUPPLIER ORG=S KLOC=20 KSZ=10 ISZ=30;
UPDATE TBL=SUPPLIER WITH=PRODUCT;
DELETE TBL=SUPPLIER ALLGEN=YES;