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
 

 

JCL: can we delete duplicate records??

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: JCL: can we delete duplicate records??
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    Post subject: Re: JCL: can we delete duplicate records??
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    Post subject: Re: JCL: can we delete duplicate records??
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 Moderator


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

PostPosted: Wed May 10, 2006 9:09 pm    Post subject:
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    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 JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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