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

JCL: can we delete duplicate records??


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

New User


Joined: 16 Feb 2006
Posts: 9

PostPosted: Wed May 10, 2006 3:31 pm
Reply with quote

my in put file is needs to be sorted on certain fields. and in the output file it should populate the last occurance (if any duplicate is there against a particular chracter set) of that record. for ex. if the in put record format is as follows:

aaabb1113333
abaaa1113333
aaaaa1113333
abbba1113333

then the output shoud be
abaaa1113333
aaabb1113333
abbba1113333

here it should sort the records on the basis of 4th and 5th chracter and later picks the latest record (on higher value of first 3 chracter set )

thanks,
anup
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Wed May 10, 2006 4:00 pm
Reply with quote

when I run a sort on this data, assuming I have understood your requirements (sort the records on the basis of 4th and 5th character)
ie
//SYSIN DD *
SORT FIELDS=(4,2,CH,A)

the the output data is in this order

abaaa1113333
aaaaa1113333
abbba1113333
aaabb1113333

your example output shows bb comeing before ba ?

then , 2nd requirement
(picks the latest record (on higher value of first 3 chracter set ) )
or is it
in the output file it should populate the last occurance (if any duplicate is there against a particular chracter set) of that record

not clear what you mean here as your output example shows that the record
aaaaa1113333
has been dropped.

Now it is a duplicate (on 1st 3 characters) of
aaabb1113333
but it does not have a higher value as aaa equals aaa
and it fails on the 2nd alternate rule as it is the last occurrance (based on the 1st 3 characters) but has been dropped.

I am very confused , you need to give a clearer specification with examples that actually follow the specification.
Back to top
View user's profile Send private message
sahaanup

New User


Joined: 16 Feb 2006
Posts: 9

PostPosted: Wed May 10, 2006 4:50 pm
Reply with quote

Sorry,
i give wrong input. the correct one should be as follows;

aabaa1113334
aaaab1113333
aaaaa1113333
abbba1113333
aaabb1113333

and the output should be

aabaa1113334
aaaab1113333
abbba1113333
aaabb1113333
the sort criteria is same as previous
sitll i am describing it : here it should first sort on 4th & 5th character and then in for multiple records these 4th & 5th character are same then it has to pick the record which has higher value for the first 3 characters.
as here in the example the record aaaaa1113333 is skipped as it is matching with aabaa1113334 for the 4th & 5th character and first 3 character (aaa) is lower then (aab).

both the things (sorting and picking one record) need to be done in one step.
hope this time it is clear.

Thanks & regards,
Anup
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 May 10, 2006 9:09 pm
Reply with quote

Anup,

Here's a 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
//OUT DD DSN=...  output file
//TOOLIN   DD    *
  SELECT FROM(IN) TO(OUT) ON(4,2,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(4,2,CH,A,1,3,CH,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 DELETE SPUFI DB2 1
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top