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

Removing duplicates on the basis on fields.


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

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Sun Dec 19, 2010 5:21 pm
Reply with quote

Hi,
I need to remove the duplicates from the file using few perticular fields.
Please give me the statement for it.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sun Dec 19, 2010 6:02 pm
Reply with quote

Well this statement is for free :

What did you try yourself?
Back to top
View user's profile Send private message
ppravin47

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Sun Dec 19, 2010 6:06 pm
Reply with quote

I did't try anything.
But my PL told me that it can be done using DFSORT.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sun Dec 19, 2010 6:35 pm
Reply with quote

The DO something instead asking others for a ready made solution. Im not working for your PL.
Back to top
View user's profile Send private message
ppravin47

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Sun Dec 19, 2010 6:48 pm
Reply with quote

Its not like that i haven't tried. But watever I have given it throws JCL error.
So thats Y I said I need a statement.
If you have some idea tell me, I will try that.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sun Dec 19, 2010 6:57 pm
Reply with quote

Then show us what you did. JCL, input, expected output, JES messages, sort messages, fields you want to operate on etc.
Back to top
View user's profile Send private message
ppravin47

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Sun Dec 19, 2010 7:18 pm
Reply with quote

Ok I have written the following step

//*********************************************************************
//STEPAAAA EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
IN5281013PB 2010-11-22-11.51.13.241123
IN5281013PB 2010-11-22-11.51.13.241109
IN5281023PB 2010-11-22-11.51.13.241176
IN5281047PB 2010-11-22-11.51.13.241189
IN5281047PB 2010-11-22-11.51.13.241437
IN5281047PB 2010-11-22-11.51.13.241490
IN5281053PB 2010-11-22-11.51.13.241504
IN5281059PB 2010-11-22-11.51.13.241557
IN5281053PB 2010-11-22-11.51.13.241610
IN5281053PB 2010-11-22-11.51.13.241624
//OUT DD DSN=I50TS.UNLOAD.IMTSIH.TEMP1,DISP=SHR
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,15,CH) LAST
/*



Using this JCL i m getting the last dup record. But now I want the record which has greater timestamp
eg.
IN5281013PB 2010-11-22-11.51.13.241123
IN5281013PB 2010-11-22-11.51.13.241109
Out of two above records i want in the output file

IN5281013PB 2010-11-22-11.51.13.241123


So Please guide me.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Dec 19, 2010 7:45 pm
Reply with quote

the requirements have changed in two hours !

the only thing where You need guidance is how to express clearly and unambiguously Your requirements

didn' t You know You wanted the highest <thing> to start with ???
Back to top
View user's profile Send private message
ppravin47

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Sun Dec 19, 2010 7:57 pm
Reply with quote

Ok I m sorry for that.
But can u please provide me the solution.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Dec 19, 2010 8:25 pm
Reply with quote

today is sunday, the DFSORT gurus work in a different time zone ( california )
do not expect an answer for them before tomorrow ( about 24 hours from now )
searching the forums wit sort max value returned quite a few hits
here is one of them
ibmmainframes.com/viewtopic.php?t=39319&highlight=dfsort+max+value
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: Mon Dec 20, 2010 1:08 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your date field starts in position 16 - adjust as necessary.

Code:

//STEPAAAA EXEC  PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD *
IN5281013PB    2010-11-22-11.51.13.241123
IN5281013PB    2010-11-22-11.51.13.241109
IN5281023PB    2010-11-22-11.51.13.241176
IN5281047PB    2010-11-22-11.51.13.241189
IN5281047PB    2010-11-22-11.51.13.241437
IN5281047PB    2010-11-22-11.51.13.241490
IN5281053PB    2010-11-22-11.51.13.241504
IN5281059PB    2010-11-22-11.51.13.241557
IN5281053PB    2010-11-22-11.51.13.241610
IN5281053PB    2010-11-22-11.51.13.241624
//OUT      DD DSN=...  output file
//TOOLIN   DD *
SELECT FROM(IN) TO(OUT) ON(1,15,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,15,CH,A,16,26,CH,D)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 20, 2010 2:49 am
Reply with quote

Hello,

Quote:
But watever I have given it throws JCL error.
What was the JCL error?

Code:
//OUT DD DSN=I50TS.UNLOAD.IMTSIH.TEMP1,DISP=SHR
Even if the job is running now, suggest you NOT use this DD statement. SHR is probably the worst choice for your output file. . . You should ask your project seniors if this is acceptable on your system - on most (all that i've ever worked on) it is not permitted.
Back to top
View user's profile Send private message
ppravin47

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Tue Dec 21, 2010 8:02 pm
Reply with quote

@Frank Yaeger

Thnks for th reply it worked out.
Actualy I was also using same JCL but I havnt given the initial spaces for the "SORT FIELDS" statement.

@dick scherrer
No In our Project we need to use SHR only
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 21, 2010 10:59 pm
Reply with quote

Hello,

Quote:
No In our Project we need to use SHR only
How unfortunate icon_sad.gif

I wonder how many jobs have generated incorrect output that has not been recognized. . . Maybe when there are abends, it will be recognized. . .
Back to top
View user's profile Send private message
ppravin47

New User


Joined: 23 Mar 2010
Posts: 17
Location: Bangalore

PostPosted: Wed Dec 22, 2010 3:42 pm
Reply with quote

@dick scherrer

I didnt got, why jobs will generate incorrect data? and it will abend?

As per I know if we give files in SHR mode. And job is using that file then at that time I can OPEN the file only in VIEW mode(I cant open in EDIT mode)...
Back to top
View user's profile Send private message
giraffe

New User


Joined: 09 Nov 2010
Posts: 27
Location: SHENZHEN CHINA

PostPosted: Wed Dec 22, 2010 5:31 pm
Reply with quote

This is my frequently-used solution:
Code:
SORT FIELDS=(...)
SUM   FIELDS=NONE

icon_smile.gif
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 Dec 22, 2010 11:20 pm
Reply with quote

Your frequently used solution wil NOT work in this case because the OP is trying to SORT with SUM on one field, but SORT without SUM on another field. You can't do that with SORT and SUM, but you can do it with SELECT as shown.

Please test your "solutions" before posting them.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 07, 2011 11:12 pm
Reply with quote

another job can have shr, but OPEN OUTPUT.
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 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 Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Removing date values lines/records fr... SYNCSORT 2
Search our Forums:

Back to Top