Arun's "solution" happens to work for the example he gave because the two records with SAM have the same amount. It will NOT work if two records with the same name have different amounts. For example, if the input is:
123456 KUMAR 300
123457 SAM 200
123458 PETER 100
123457 SAM 200
123457 SAM 300
The output would be:
123458 PETER 100
123457 SAM 200
123456 KUMAR 300
123457 SAM 300
Notice that SAM appears twice in the output.
This DFSORT/ICETOOL job would work for the general case:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
123456 KUMAR 300
123457 SAM 200
123458 PETER 100
123457 SAM 200
123457 SAM 300
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN1) TO(T1) ON(8,5,CH) FIRST
SORT FROM(T1) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(14,3,ZD,A)
/*
The output would be:
123458 PETER 100
123457 SAM 200
123456 KUMAR 300
Of course, it's not clear which salary you want in the output when a name is associated with two different salaries.