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

Can't we eliminate the duplicate records while copying.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Apr 09, 2008 12:59 pm
Reply with quote

Hi All,

I am just copying the records from an input dataset to an output dataset which will meet some criteria.But while copying I want to eliminate duplicates.I have added SUM FIELDS=NONE. But it is not working instead it is copying the record as many times as it exist in the input file.

SUM FIELDS=NONE will work only for SORT process. Then please tell me how to eliminate the duplicates while copying.

Regards
Amar
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Apr 09, 2008 1:00 pm
Reply with quote

My code is as follows
Code:

OPTION COPY                                           
INCLUDE  COND=(3,7,CH,EQ,C' BEGIN ',OR,(1,1,CH,EQ,     
               C'*',AND,11,2,CH,EQ,C' *'))             
SUM FIELDS=NONE                                       
INREC IFOUTLEN=160,                                   
IFTHEN=(WHEN=(3,7,CH,EQ,C' BEGIN '),                   
  BUILD=(10,7)),                                       
IFTHEN=(WHEN=(1,1,CH,EQ,C'*',AND,11,2,CH,EQ,C' *'),   
  BUILD=(2,3,                                         
         5:C'Model do not follow the correct syntax.'))
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Wed Apr 09, 2008 1:32 pm
Reply with quote

Hello V S Amarendra Reddy,

You can try this below card where :

p=position of the field that you want to check for duplicates in the record
l=lenght of that field
t=type of that field for ex.CH ,ZD or PD.

You can have more then one ON conditions:

Code:
//TOOLIN DD *
SELECT FROM(input file) TO(output file) ON(p,l,t) NODUPS
/*


If this doesnt work out then let us the position and length of the fields in the record for which you want to check the duplicate condition.

Regards,
Rajat
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Apr 09, 2008 1:44 pm
Reply with quote

Hi Rajat,

Thanks for the reply. Thing is my whole function is working properly with DFSORT except the duplicates are coming out in the output dataset. I think your suggestion uses the ICETOOL. Now for duplicates alone If I change the sort to SYNCSORT then I need to implement the whole functionality(Formatting of records) in ICETOOL again.I am not that aware of SYNCSORT as DFSORT.

Can you please let me know is there any possibility to implement it in DFSORT.

Regards
Amar
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Apr 09, 2008 2:46 pm
Reply with quote

how in heaven can You expect to eliminate duplicates without sorting ??
any process trying to eliminate duplicates will expect to have them contiguous
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Apr 09, 2008 2:51 pm
Reply with quote

Hello,

I added sort also like this even then it was not working.

Code:
OPTION COPY                                           
INCLUDE  COND=(3,7,CH,EQ,C' BEGIN ',OR,(1,1,CH,EQ,     
               C'*',AND,11,2,CH,EQ,C' *'))             
SORT FIELDS=(2,3,CH,A)                                 
SUM FIELDS=NONE                                       
INREC IFOUTLEN=160,                                   
IFTHEN=(WHEN=(3,7,CH,EQ,C' BEGIN '),                   
  BUILD=(10,7)),                                       
IFTHEN=(WHEN=(1,1,CH,EQ,C'*',AND,11,2,CH,EQ,C' *'),   
  BUILD=(2,3,                                         
         5:C'Model do not follow the correct syntax.'))



Please check if if there are any mistakes in the above code.

Regards
Amar
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: Wed Apr 09, 2008 8:34 pm
Reply with quote

SUM FIELDS=NONE can only be used with SORT or MERGE, not with COPY. That's because eliminating duplicates requires a "key" to define the duplicates. If your records are already in sorted order, you can use MERGE rather than SORT with SUM FIELDS=NONE. MERGE is generally more efficient than SORT. If your records are not in sorted order, then you need to use SORT with SUM FIELDS=NONE.

Quote:
Please check if if there are any mistakes in the above code.


The OPTION COPY statement overrides the SORT statement so you are still doing a COPY, not a SORT. Remove OPTION COPY. DFSORT message ICE143I tells you if you are doing a COPY, SORT or MERGE.

Note also that your INREC reformatting will be performed before SORT and SUM so the SORT statement will operate on the reformatted records. I'm not sure if that's what you wanted or not. If you want to reformat after sorting, use an OUTREC statement rather than an INREC statement.
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Wed Apr 09, 2008 8:50 pm
Reply with quote

Frank,

You are always there for my queries. Thanks Now I am clarified.


Regards
Amar
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