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
 

 

How to remove duplicates in PS file without cahnging the pos

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ashok_uddaraju

New User


Joined: 21 Feb 2007
Posts: 72
Location: bangalore

PostPosted: Wed Jan 25, 2012 3:31 pm    Post subject: How to remove duplicates in PS file without cahnging the pos
Reply with quote

Hi,

I have a PS file which has input like

abcd
abcd
1/2/3
11:23:24
defg
defg
3/4/5
10:34:56
asdf
asdf
7/5/8
12:34:57

Expected output is :

abcd
1/2/3
11:23:24
defg
3/4/5
10:34:56
asdf
7/5/8
12:34:57

I just want to remove duplicate entries without changing the postion of rest.Can you please suggest on this ?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Jan 25, 2012 3:35 pm    Post subject: Reply to: How to remove duplicates in PS file without cahngi
Reply with quote

You have Syncsort?

Have you searched here, used google, tried anything you'd like to let us know about?
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Jan 25, 2012 5:06 pm    Post subject:
Reply with quote

ICETOOL :
Try this

Code:

//TOOLIN DD *                                       
  SELECT FROM(FILE1) TO(SORTOUT) ON(1,20,CH) FIRST 


define your length accordingly icon_smile.gif
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Jan 25, 2012 6:40 pm    Post subject:
Reply with quote

elango_K wrote:
ICETOOL :
Try this

Code:

//TOOLIN DD *                                       
  SELECT FROM(FILE1) TO(SORTOUT) ON(1,20,CH) FIRST 


define your length accordingly icon_smile.gif


will SORT the records - which the TS did NOT want.

I suggest adding a SEQNUM to the records during INREC processing, then SORT with SUM FIELDS=NONE to drop duplicates. Next, SORT based on the SEQNUM that was added and drop the SEQNUM during output processing. This gives the remaining records in the original order.

Garry.
Garry.
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Jan 25, 2012 8:04 pm    Post subject:
Reply with quote

Hi Garry,

My mistake. icon_sad.gif

Code:

//SYSIN  DD *                                           
  SORT FIELDS=(1,39,CH,A)                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(40:SEQNUM,8,ZD))     
  SUM FIELDS=NONE                                       


Sort this output agin.


Code:

//SYSIN  DD *                                           
  SORT FIELDS=(40,8,ZD,A)                         
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Jan 25, 2012 8:41 pm    Post subject:
Reply with quote

Garry Carroll wrote:
[...] and drop the SEQNUM during output processing. This gives the remaining records in the original order.

Garry.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Wed Jan 25, 2012 10:08 pm    Post subject: Reply to: How to remove duplicates in PS file without cahngi
Reply with quote

the main problem is that the proposed solution will get rid of ALL duplicates
( wherever they might occur ) not just the contiguous ones

anyway here are the sort control cards for the task


Code:
 000023   OPTION COPY                                                           
 000024   INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,80)))     
 000025   OUTFIL INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)                       
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1771
Location: Bloomington, IL

PostPosted: Wed Jan 25, 2012 10:28 pm    Post subject: Re: Reply to: How to remove duplicates in PS file without ca
Reply with quote

enrico-sorichetti wrote:
the main problem is that the proposed solution will get rid of ALL duplicates
( wherever they might occur ) not just the contiguous ones

The TS failed to tell us if non-contiguous duplicates are expected or what should be done if they occur. Therefore, he is in the position of consuming what we choose to dish up.
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Jan 25, 2012 11:22 pm    Post subject:
Reply with quote

If the idea is to delete all the duplicates and to maintain the order,
Can this be achieved in a single step ?
If so, how?
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: Thu Jan 26, 2012 12:20 am    Post subject:
Reply with quote

Quote:
will SORT the records - which the TS did NOT want.


You can have the SELECT operator of DFSORT's ICETOOL avoid a SORT by specifying a COPY. For example:

Code:

//TOOLIN DD *                                       
  SELECT FROM(FILE1) TO(SORTOUT) ON(1,20,CH) FIRST  USING(CTL1)
//CTL1CNTL DD *
   OPTION COPY


In this case, only the contiguous duplicates will be affected.
Back to top
View user's profile Send private message
ashok_uddaraju

New User


Joined: 21 Feb 2007
Posts: 72
Location: bangalore

PostPosted: Thu Jan 26, 2012 8:40 am    Post subject:
Reply with quote

Thanks, i am able to get the result
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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