Am not sure, whether you can directly Read the Second duplicate Record.
But, You can set the Pointer using SETLL and you can read the records sequentially(Second Read Record would be the Required Second duplicate).
KFLD SETLL FILENM
KFLD READE FILENM
Or, If you want to Read the Last Duplicate Record, You can set the pointer using SETGT and read the Prior Records using READP
KFLD SETGT FILENM
KFLD READP FILENM
Issue the READ instruction twice after positioning to the desired value with SETLL. If the value from the second READ matches the value that you saved from the first READ, you know you have the second duplicate.
You could also use CHAIN instead of SETLL and the first READ. A CHAIN instruction can do both functions in a single operation. Then issue a READ and compare its value to the one you saved from CHAIN. Again, if it matches, you know you have read the second of duplicate values.
Input primary, level indicators, and a counter.