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

Remove a set of duplicates


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

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Wed Aug 13, 2008 5:17 pm
Reply with quote

Hi Friends,
I have a sample input file which looks like this
Code:

AABB 213456 0001 1001
AABB 213456 0001 2002
AABB 213456 0001 3003
AABB 213456 0001 4004
AABB 213456 0001 5005
AABB 213456 0001 6006

AABB 123458 0002 0101
AABB 123458 0002 0202
AABB 123458 0002 0303
AABB 123458 0002 0404
AABB 123458 0002 0505

AABB 123458 0003 0051
AABB 123458 0003 0052
AABB 123458 0003 0053
AABB 123458 0003 0054
AABB 123458 0003 0055 

AABB 412489 0004 0401
AABB 412489 0004 0402
AABB 412489 0004 0403
AABB 412489 0004 0404

There are no empty lines between the records just for understanding i copied like that.
Each record is made of key which is of 3 parts.
First part is same for all the records.
Socond part may be same for more than one set of records.
Third part will be different for every set of records.
Fourth part is just data which may be any thing.

Requirement is if the first 10 bytes of is same for 2 sets of data.
Retain the data of only one set in to the output file and all other sets will be written to second file.
Output1:

Code:

AABB 213456 0001 1001
AABB 213456 0001 2002
AABB 213456 0001 3003
AABB 213456 0001 4004
AABB 213456 0001 5005
AABB 213456 0001 6006

AABB 123458 0002 0101
AABB 123458 0002 0202
AABB 123458 0002 0303
AABB 123458 0002 0404
AABB 123458 0002 0505

AABB 412489 0004 0401
AABB 412489 0004 0402
AABB 412489 0004 0403
AABB 412489 0004 0404

Ouput2:
Code:

AABB 123458 0003 0051
AABB 123458 0003 0052
AABB 123458 0003 0053
AABB 123458 0003 0054
AABB 123458 0003 0055 


The key '123458' is same for second and third set so, this set should come to ouput2
I tried to put the question as simple as I can
Hope I am clear
Regards,
Balu
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 13, 2008 6:39 pm
Reply with quote

Balu,

Can you provide some more inputs?????

Quote:
Socond part may be same for more than one set of records.

If the second part is the same for 2 groups, will both the groups have the same number of records????

Thanks,
Arun
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 13, 2008 7:25 pm
Reply with quote

Balu,

You might want to give this a try. I have assumed FB files of LRECL=80. This works even if the second group has different number of records.

JCL
Code:
//STEP01   EXEC PGM=SORT                                           
//*                                                               
//SYSOUT   DD SYSOUT=*                                             
//*                                                               
//SORTIN   DD DSN=your.input.file,DISP=SHR                                               
//OUT1     DD SYSOUT=*                                             
//OUT2     DD SYSOUT=*                                             
//*                                                               
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(13,4))),
        IFTHEN=(WHEN=INIT,OVERLAY=(89:SEQNUM,8,ZD,RESTART=(1,11)))
  SORT FIELDS=COPY                                                 
  OUTREC OVERLAY=(81:89,8,ZD,SUB,81,8,ZD,M11,LENGTH=8)             
  OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,0),BUILD=(1,80)           
  OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)                             
//*         


SORTIN input
Code:
AABB 213456 0001 1001
AABB 213456 0001 2002
AABB 213456 0001 3003
AABB 213456 0001 4004
AABB 213456 0001 5005
AABB 213456 0001 6006
AABB 123458 0002 0101
AABB 123458 0002 0202
AABB 123458 0002 0303
AABB 123458 0002 0404
AABB 123458 0002 0505
AABB 123458 0003 0051
AABB 123458 0003 0052
AABB 123458 0003 0053
AABB 123458 0003 0054
AABB 123458 0003 0055
AABB 412489 0004 0401
AABB 412489 0004 0402
AABB 412489 0004 0403
AABB 412489 0004 0404


OUT1
Code:
AABB 213456 0001 1001
AABB 213456 0001 2002
AABB 213456 0001 3003
AABB 213456 0001 4004
AABB 213456 0001 5005
AABB 213456 0001 6006
AABB 123458 0002 0101
AABB 123458 0002 0202
AABB 123458 0002 0303
AABB 123458 0002 0404
AABB 123458 0002 0505
AABB 412489 0004 0401
AABB 412489 0004 0402
AABB 412489 0004 0403
AABB 412489 0004 0404


OUT2
Code:
AABB 123458 0003 0051
AABB 123458 0003 0052
AABB 123458 0003 0053
AABB 123458 0003 0054
AABB 123458 0003 0055


Thanks,
Arun
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Wed Aug 13, 2008 8:58 pm
Reply with quote

Hi,

arcvns,

Quote:
will both the groups have the same number of records????

Not necceserily

Arun,
Thanks a lot, Understood the solution.

Thanks,
Balu
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
No new posts To Remove spaces (which is in hex for... JCL & VSAM 10
Search our Forums:

Back to Top