How to handle duplicate record in VSAM KSDS while accessing the file Dynamically.
Iam using the below code, but some how iam getting the duplicate records.
IF BCTEMP-FILE-STATUS EQUAL TO 0 AND
BCTEMP-REC-KEY EQUAL TO W-TEMP-ACCT-REC
DISPLAY 'TEMP-FILE-STATUS:' BCTEMP-FILE-STATUS
MOVE W-TEMP-ACCT-REC TO BCTEMP-RECORD
SET S-ACCT-GENERATED-Y TO TRUE
Joined: 11 Dec 2008 Posts: 59 Location: Pune , India
Well i doubt VSAM KSDS will have duplicate key and duplicate record . Unless it has a Alternate Key ( With alternate index defined with parameter NONUNIQUEKEY ) and you are referring this alternate key. A simple suggestion will be to have the output file in a FFB and then remove the duplicate records ( having duplicate key ) with SORT and then REPRO to a VSAM file . A similar thing can be done in the Input file also otherwise. That however depends upon your requirement.