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
 

 

Last 3 duplicates of each key value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sandy0407

New User


Joined: 01 Aug 2010
Posts: 7
Location: Morley

PostPosted: Thu Apr 14, 2011 11:45 pm    Post subject: Last 3 duplicates of each key value
Reply with quote

Hi,

I have the following requirement:

The input file is of 10 bytes (FB) as given below and the key is first 6 bytes (numeric). There are duplicate values in the file as shown below. The requirement is to write at most last 3 duplicates of each key value while keeping the order of records same. The output file is also of 10 bytes FB.

The input file is as given below:

111111AAAA
111111ABCD
111111ACVB
111111CCCC
111111BBBB
123456AAAA
123456BBBB
333333VVVV
333333BBBB
333333NNNN
333333TTTT

The output required is as shown below:

111111ACVB
111111CCCC
111111BBBB
123456AAAA
123456BBBB
333333BBBB
333333NNNN
333333TTTT

I have achieved the results using sort and icetool in multiple steps. But can it done in a single step?

Thanks and Regards.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Apr 15, 2011 1:09 am    Post subject:
Reply with quote

Here's a one step DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/10)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/10)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(1,6,CH) FIRST(3) -
  USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(11:SEQNUM,8,ZD)
  SORT FIELDS=(1,6,CH,A,11,8,ZD,D)
/*
//CTL2CNTL DD *
  SORT FIELDS=(1,6,CH,A,11,8,ZD,A)
  OUTREC BUILD=(1,10)
/*
Back to top
View user's profile Send private message
sandy0407

New User


Joined: 01 Aug 2010
Posts: 7
Location: Morley

PostPosted: Fri Apr 15, 2011 1:35 am    Post subject:
Reply with quote

Thanks Frank. I used the same logic but in 3 different steps.

However, I had faced problems while using temporary file as the input file was very large (about 7 million records). We increased the number of cylinders of the temp dataset but the job was still failing due to space abend.

When we hard coded the intermediate file (replaced the temporary file with an emplty file created in other step) and then passed it to the subsequent steps , the problem was resolved.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Apr 15, 2011 1:58 am    Post subject:
Reply with quote

Sandy,

My job uses T1 for output and then input. T1 can be a permanent file if you need it to be. So you should be able to use my one step job.
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 SORT CARD to remove duplicates & ... mkk157 DFSORT/ICETOOL 17 Tue Jul 08, 2014 9:04 pm
No new posts Remove the duplicates without sorting... maki_psg JCL & VSAM 13 Tue May 13, 2014 10:32 pm
No new posts Having issues removing duplicates thesumitk JCL & VSAM 8 Sat Apr 26, 2014 4:01 pm


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