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

How to remove duplicates in PS file without cahnging the pos


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashok_uddaraju

New User


Joined: 21 Feb 2007
Posts: 72
Location: US

PostPosted: Wed Jan 25, 2012 3:31 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 25, 2012 3:35 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jan 25, 2012 6:40 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 25, 2012 8:41 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 25, 2012 10:08 pm
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: 1788
Location: Bloomington, IL

PostPosted: Wed Jan 25, 2012 10:28 pm
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
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 Developer


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

PostPosted: Thu Jan 26, 2012 12:20 am
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: US

PostPosted: Thu Jan 26, 2012 8:40 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top