IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Duplicate Records removal question


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abhijat Sinha

New User


Joined: 22 Jun 2007
Posts: 11
Location: India

PostPosted: Thu Oct 11, 2007 10:22 am
Reply with quote

Hi,
I have a following set of input data
Code:

col1  col2  col3  col4
======================
001    aaa   1234  xxx
002    aaa   5678  xxx
003    aaa   1234  xxx
004    aaa   5678  xxx

When i try to use the ICEMAN to sort these records on the basis of following sort card -
Code:

SORT FIELDS=(col2,03,CH,A,col4,03,CH,A,col3,04,CH,A)
SUM FIELDS=NONE                                                       

we are getting the follwing out put-
Code:

col1  col2  col3  col4
======================
001    aaa   1234  xxx
004    aaa   5678  xxx


Now I was expecting 001 and 002 in the col1 instead am getting 001 and 004. Is there any specific reason for this specific type of data? Can anyone please explain how the data was processed to get me the above result?

Thank you,
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Thu Oct 11, 2007 10:32 am
Reply with quote

Try with SORT FIELDS=(col2,03,CH,A,col4,03,CH,A,col3,04,CH,A), EQUALS
SUM FIELDS=NONE
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Oct 11, 2007 10:57 am
Reply with quote

This is what i got when i tried with your sort card

Code:
//S1    EXEC  PGM=SORT                                   
//SYSOUT    DD  SYSOUT=*                                 
//SORTIN DD *                                             
001    AAA   1234  XXX                                   
002    AAA   5678  XXX                                   
003    AAA   1234  XXX                                   
004    AAA   5678  XXX                                   
/*                                                       
//SORTOUT DD SYSOUT=*                                     
//SYSIN    DD    *                                       
 SORT FIELDS=(8,3,CH,A,20,3,CH,A,14,4,CH,A)               
 SUM FIELDS=NONE                                         
/*                                                       


output:

Code:
001    AAA   1234  XXX
002    AAA   5678  XXX
Back to top
View user's profile Send private message
Abhijat Sinha

New User


Joined: 22 Jun 2007
Posts: 11
Location: India

PostPosted: Thu Oct 11, 2007 12:12 pm
Reply with quote

Hi Nuthan,
The sort card with EQUALS worked. But is there any explanation for this? Is there any link for this EQUALS that i can go through?

Thanks.

Aaru,
I tried to run your JCL itself but i got 001 and 004 itself instead of your suggested 001 and 002. Can you please re-check?

Thank you
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Oct 11, 2007 12:25 pm
Reply with quote

Hello,

Quote:
The sort card with EQUALS worked. But is there any explanation for this?
EQUALS tells the process to preserve the original order of the data within the "sort keys". If EQUALS is not specified, the order of the data will be unpredictable beyond the specified keys.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Oct 11, 2007 12:48 pm
Reply with quote

Check this link http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca20/3.12?ACTION=MATCHES&REQUEST=EQUALS&TYPE=FUZZY&SHELF=ICE1SH20.bks&DT=20060615185603&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT for the topic OPTION Control Statement.
and http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca20/3.16?ACTION=MATCHES&REQUEST=EQUALS&TYPE=FUZZY&SHELF=ICE1SH20.bks&DT=20060615185603&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT for SORT Control Statement.

Also for performance recomendations look at Avoid Options That Might Degrade Performance here http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1cg20/2.9.11?ACTION=MATCHES&REQUEST=EQUALS,option&SHELF=ICE1SH20.bks&DT=20060615173822&TYPE=FUZZY&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Thu Oct 11, 2007 3:03 pm
Reply with quote

Abhijat,

Quote:
Aaru,
I tried to run your JCL itself but i got 001 and 004 itself instead of your suggested 001 and 002. Can you please re-check?


I ran the same JCL again and the output is still the same (001 and 002).
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Oct 11, 2007 9:19 pm
Reply with quote

Aaru,

Your site default is probably EQUALS. Abhijit's site default is NOEQUALS. DFSORT is shipped with NOEQUALS as the default, but the site can change that to EQUALS.

If you're using DFSORT (and I'm not sure you are), you can see the value for EQUALS in message ICE128I ... it will have EQUALS=N or EQUALS=Y.

You can try using:

Code:

   OPTION NOEQUALS


to turn off EQUALS and see what you get. However, you still might get 001 and 002 since with NOEQUALS, either record can be kept.

The only way to ensure that the first record is kept is to use EQUALS.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Oct 12, 2007 10:48 am
Reply with quote

Frank,

You are correct. Had a look at the sysout and found that the option EQUALS is in effect.

Code:
WER072I  EQUALS IN EFFECT


Thanks a ton.
Back to top
View user's profile Send private message
venktv

New User


Joined: 29 Mar 2006
Posts: 59
Location: Montreal

PostPosted: Fri Oct 12, 2007 4:50 pm
Reply with quote

With EQUALS, the SORT program will give the first record of the identical records(duplicate records) found when it sorts.

WIth regs
Venkat
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Oct 12, 2007 8:55 pm
Reply with quote

Aaru,

As I guessed, you're using Syncsort (WER messages), not DFSORT.

Since this is the DFSORT Forum and you can't test with DFSORT, your results will not always be relevant. You might want to think about that, especially in regard to making statements about what works for you since DFSORT and Syncsort do have differences.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top