Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Remove a set of duplicates

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Remove a set of duplicates
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: 2180
Location: @my desk

PostPosted: Wed Aug 13, 2008 6:39 pm    Post subject:
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: 2180
Location: @my desk

PostPosted: Wed Aug 13, 2008 7:25 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Remove Special Characters from Mainfr... Rodger Zhang All Other Mainframe Topics 6 Wed Jul 06, 2016 1:12 am
No new posts Remove header only knobi SYNCSORT 5 Mon Feb 15, 2016 10:42 pm
No new posts Append to file, but also remove old r... Garry Carroll JCL & VSAM 3 Mon Jan 25, 2016 8:05 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us