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

How to remove duplicates from file with keeping a count


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

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Mon Jun 25, 2012 1:13 pm
Reply with quote

Hi All,



How to remove the duplicates from a file based on some condition and keeping the count of duplicate records eliminated using ICETOOL or DFSORT?

I have a file with following records:



01NITINSURRENDER10OWNER BHARGAVA

01NITINSURRENDER00INSURED BHARGAVA

01NITINSUREENDER30CO-OWNER BHAR

01ROHITACTIVE 20CO-INSUREDSINGHAI

01ROHITACTIVE 00INSURED SINGHAI

01ROHITACTIVE 10OWNER SINGH

01NIKHITERMINATE00INSURED JAIN



Here first 7 bytes are the key, next 10 bytes is for status, next 2 bytes is for TypeCode, next 10 bytes for TypeCode description and last 10 bytes for surname.

I have to first sort it in ascending order based on key and typecode. I did it using below sort.



SORT FIELDS=(1,7,CH,A,17,2,CH,A)

After this the file looks like

01NITINSURRENDER00INSURED BHARGAVA

01NITINSURRENDER10OWNER BHARGAVA

01NITINSUREENDER30CO-OWNER BHAR

01ROHITACTIVE 00INSURED SINGHAI

01ROHITACTIVE 10OWNER SINGH

01ROHITACTIVE 20CO-INSUREDSINGHAI

01NIKHITERMINATE00INSURED JAIN



Now I want to only consider TypeCode 00 and 10 (byte 17-18) and then have to remove the duplictae. For removing duplicate, condition is I have to consider full record except byte 17 to 26.



In output, even I don’t have to consider records with status as “SURRENDER” or “TERMINATE” and have to keep the count for records eliminated.



Output will look like :

01ROHITACTIVE 00INSURED SINGHAI



Whether it is possible to do all this in one step using ICETOOL or DFSORT?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Mon Jun 25, 2012 1:24 pm
Reply with quote

Quote:
... have to keep the count for records eliminated.

Where do you keep the count? Do want the count in a separate data set?

If so, please post how it should be in this case.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 25, 2012 1:24 pm
Reply with quote

You only want type 00 and 10. You don't want those if they are "SURRENDER" or "TERMINATE". You then want to drop duplicates based on 1-16.

Somehow a count comes into it which you didn't explain.

Is that it?
Back to top
View user's profile Send private message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Mon Jun 25, 2012 2:06 pm
Reply with quote

one correction in output:

The output will look like
01ROHITACTIVE 00INSURED SINGHAI
01ROHITACTIVE 10OWNER SINGH

For total count: I just have to populate it in a PS of 80 bytes. In this case the total record skipped are 5 so output will be:

Count: 5
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 25, 2012 2:38 pm
Reply with quote

I think I'd look in the Smart DFSORT Tricks book for the example of XSUM (and much more). If at the end you really find that a blind count of duplicates dropped is useful, you can just COUNT on the file created.
Back to top
View user's profile Send private message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Mon Jun 25, 2012 3:38 pm
Reply with quote

could we do it in 2 steps
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 25, 2012 3:47 pm
Reply with quote

Err... Yes. On the confirmation you have given I can say almost definitely yes.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jun 25, 2012 9:26 pm
Reply with quote

Nitin Bhargava,

Nitin Bhargava wrote:
Here first 7 bytes are the key, next 10 bytes is for status, next 2 bytes is for TypeCode, next 10 bytes for TypeCode description and last 10 bytes for surname.

Now I want to only consider TypeCode 00 and 10 (byte 17-18) and then have to remove the duplictae. For removing duplicate, condition is I have to consider full record except byte 17 to 26.



Something doesn't add up. You need to get your positions right. Based on the first part of your description about the fields Typecode + Type code description start at position 18 and the surname is at position 30. However you want to eliminate duplicates without considering byte 17 thru 26? That would split the Typecode description.
Back to top
View user's profile Send private message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Tue Jun 26, 2012 4:13 pm
Reply with quote

i am able to do it in 2 steps by myself....thanks to all
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: Tue Jun 26, 2012 11:15 pm
Reply with quote

Hello,

As your request was not clear and your details incorrect, it is probably best that you did get it running by yourself. . .

d
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To get the count of rows for every 1 ... DB2 3
Search our Forums:

Back to Top