90 pts.
 Rpg400
how to read the second duplicate value using rpg

Software/Hardware used:
ASKED: November 18, 2011  5:09 AM
UPDATED: March 6, 2012  6:40 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,380 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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

Pradeep.

 3,370 pts.

 

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.

Tom

 107,735 pts.

 

Input primary, level indicators, and a counter.

 5,670 pts.