Example 1: Unique-key processing

 

This example shows how to read only unique-key records. Assume that you want to process FILEA, which has records with duplicate keys for the Cust field. You want only the first record for each unique value of the Cust field to be processed by program PGMF. You can specify:

OVRDBF     FILE(FILEA) SHARE(*YES)
OPNQRYF    FILE(FILEA) KEYFLD(CUST) UNIQUEKEY(*ALL)
CALL       PGM(PGMF)
CLOF       OPNID(FILEA)
DLTOVR     FILE(FILEA)

 

Parent topic:

Unique-key processing