View previous topic :: View next topic
|
Author |
Message |
Johore
Specialist
Joined: 12 Sep 2003 Posts: 19
|
|
|
|
Dear Friends
I would like to know how I can remove duplicate records while sorting a file in JCL .
I have come accross SUM FIELDS = NONE option .IS this the only way.
Thanks in advance ,
Johore |
|
Back to top |
|
|
abdul
EXPERT
Joined: 28 Jul 2003 Posts: 23 Location: Bangalore,India
|
|
|
|
Hi,
You can use SORT FIELDS=NONE for removeing duplicates in SORT. This is the easiest way to remove duplicates in a file. Could you pls explain the requirement that you have. Based on that I can give you some more methods to do the same.
Thanks
abdul |
|
Back to top |
|
|
jayant_tibhe
New User
Joined: 25 Feb 2006 Posts: 27 Location: Pune
|
|
|
|
Hi Johor,
You don't have to code all the fields in your sort card. You can either use CH or BI as the SORT format, for all fields.
U can USe the Code..
SORT FIELDS=(1,4043,BI,A)
OR
SORT FIELDS=(1,4043,CH,A) |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I would like to know how I can remove duplicate records while sorting a file in JCL .
I have come accross SUM FIELDS = NONE option .IS this the only way. |
You can also use the SELECT operator of DFSORT's ICETOOL to remove duplicates like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(p,m,f) FIRST
/*
|
where p,m,f describes the key you want to check for duplicates on. p is the starting position, m is the length and f is the format.
I would argue that SELECT is the easiest way to remove duplicates. In addition, SELECT gives you a lot more ways to deal with duplicates than SUM FIELDS=NONE does. Besides FIRST, you can use LAST, FIRSTDUP, LASTDUP, ALLDUPS, NODUPS, HIGHER(n), LOWER(n) and EQUALS(n). SUM FIELDS=NONE only does the FIRST function.
For complete details on the SELECT operator of DFSORT's ICETOOL, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.11?DT=20060615185603 |
|
Back to top |
|
|
|