how to eliminate the duplicates in sorting

Answers were Sorted based on User's Feedback



how to eliminate the duplicates in sorting..

Answer / seema dawlekar

WE CAN ELIMINATE DUPLICATES IN SORTING BY SORT UTILITY
SYNTAX IS
SORT FIELDS=(STARTING POSITING,LENGTH,TYPE,A),EQUALS
SUM FIELDS=NONE

THIS WILL SORT THE FIELDS IN ASCENDING ORDER AND ELIMINATES
ALL THE DUPLICATES, AS WE ARE GIVING 'EQUALS' IT WILL TAKE
THE FIRST RECORD AND ELIMINATES REST OF THE DUPLICATE
RECORDS IN A FILE.

Is This Answer Correct ?    10 Yes 0 No

how to eliminate the duplicates in sorting..

Answer / muttaiah

use the Sort utility, In the instream data of the sort card
Specify.
//sysin dd *
sort fields=copy
sum fields=none,xsum
/*
for this you need to have a dd stmt as
//sortxsum dd dsn=datasetname, disp=(createnew, share)

Now, the output file will have the records without
duplicates & the duplicates will be captured in the above
dsn of the sortxsum dd.

Correct me if i'm wrong

Is This Answer Correct ?    3 Yes 1 No

how to eliminate the duplicates in sorting..

Answer / stu

Pandu,

Answers 1 & 3 are correct. SUM FIELDS tells SORT that only
1 record with the the same values in the SORT FIELDS will be
written to the SYSOUT. SUM FIELDS=NONE tells SORT there are
no fields to SUM, but only keep one record for each distinct
combination of the sort fields.

Examples:
SORT FIELD=1,5,CH,A) SORT FIELD=1,5,CH,A)
SUM FIELDS=(7,1,ZD) SUM FIELDS=NONE,EQUALS

----+----1 ----+----1
PANDU 1 PANDU 1
PANDU 4 PANDU 4
CRAIG 3 CRAIG 3
PANDU 3 PANDU 3
HARPO 6 HARPO 6

results in
----+----1 ----+----1
CRAIG 3 CRAIG 3
HARPO 6 HARPO 6
PANDU 8 PANDU 1

Is This Answer Correct ?    3 Yes 1 No

how to eliminate the duplicates in sorting..

Answer / pandu

Hi Seema Thank you for answered my question but in my view
there is no sum i.e i don't want sum if there is
esalary.suppose one table contains 'Pandu' name more than
times but i want prient only one time.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More JCL Interview Questions

There are 2PROCS in a JCL. I want following conditions to be carried out 1) 1st PROC should be executed as such In second PROC 2) First 4steps should not be executed 3) 5th step should not be executed 4) 6th and 7th step should be executed The change should be done only in the JCL and PROC should be untouched ?

3 Answers   ADP,


How we can code in a jcl to execute a job in a particular time and date without using any job shudular?. (Eg) i want to execute a particular job at 8 am on 01/01/2010.

2 Answers   Target,


Which is the most widely used batch performance monitor for DB2?

2 Answers  


What is the function of the steplib dd statement?

0 Answers  


Which storage devices are grouped under DASD and SYSDA ?

1 Answers   IBM,






In SPACE,what is directory,RLSE

6 Answers   TCS,


How do you submit a JCL under CICS environment ?

5 Answers   Wipro,


Suppose I have Five Steps in PROC In this Case I want to Execute third Step in PROC using Main JCL don't use any COND Explain with Coding Thanks & Regards SHREE

4 Answers   Merrill Lynch,


i have a file which contains duplicates ? my requirement is to eliminate duplicates and these elminated duplicates should be moved to another file can any code this using sort ?

3 Answers   IBM,


Can we use COND=EVEN on a job card, when jobs are scheduled through scheduler?

5 Answers   L&T,


Explain the function of //jcllib statement?

0 Answers  


How do you access a file that had a disposition of KEEP?

3 Answers  


Categories