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
 

 

Removing duplicates on the basis on fields.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Removing duplicates on the basis on fields.
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Sun Dec 19, 2010 6:02 pm    Post subject:
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    Post subject: Reply to: Removing duplicates on the basis on fields.
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Sun Dec 19, 2010 6:35 pm    Post subject:
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    Post subject: Reply to: Removing duplicates on the basis on fields.
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Sun Dec 19, 2010 6:57 pm    Post subject:
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    Post subject: Reply to: Removing duplicates on the basis on fields.
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Dec 19, 2010 7:45 pm    Post subject: Reply to: Removing duplicates on the basis on fields.
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    Post subject: Reply to: Removing duplicates on the basis on fields.
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun Dec 19, 2010 8:25 pm    Post subject: Reply to: Removing duplicates on the basis on fields.
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
http://ibmmainframes.com/viewtopic.php?t=39319&highlight=dfsort+max+value
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: Mon Dec 20, 2010 1:08 am    Post subject:
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:

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

Site Director


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

PostPosted: Mon Dec 20, 2010 2:49 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Dec 21, 2010 10:59 pm    Post subject:
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    Post subject:
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: 28
Location: SHENZHEN CHINA

PostPosted: Wed Dec 22, 2010 5:31 pm    Post subject:
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 Moderator


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

PostPosted: Wed Dec 22, 2010 11:20 pm    Post subject:
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    Post subject:
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    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 1 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 Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am
No new posts Need Help to Define 36 Input Fields (... satish.ms10 CLIST & REXX 2 Sat May 07, 2016 3:08 pm


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