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

Retain only unique reccords


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

New User


Joined: 15 Aug 2009
Posts: 29
Location: Chennai

PostPosted: Wed Jun 30, 2010 12:56 pm
Reply with quote

Hi,

if my input file has duplicate values i want my output file to copy only non duplicate record.

Sortfields=none will remove all duplicates and retain one row from it.
but what i need is if more than one same records are there the i dont want to copy all those record to my output file.

Ex:
I/P

123 aaa
123 aaa
123 aaa
999 ccc

Expected O/P

999 ccc

I dont want to copy 123 aaa as it have duplicate rows.

some one Guide me plz
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 30, 2010 1:08 pm
Reply with quote

answering because of duplicate post/topic,

thanks to expat for the following text ...

This has been dicussed quite a few times and various examples exist in both the DFSORT and JCL forums. But, because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and the topic will be moved into the JCL forum by one of the moderators. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY


after You post the <sort> you are using somebody will delete the useless duplicate
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 30, 2010 1:47 pm
Reply with quote

since You are using SYNCSORT the duplicate post on the dfsort forum was deleted
Back to top
View user's profile Send private message
lagneshp

New User


Joined: 15 Aug 2009
Posts: 29
Location: Chennai

PostPosted: Wed Jun 30, 2010 6:47 pm
Reply with quote

Hi my

I/P :

000001 0000000000000000000000
000002 0010000000040100138375996
000003 0020000000040100138375996
000004 0030000000040100138375996
000005 0040000000040100152384996
000006 0040000000040100286372996
000007 0040000000040100295365996
000008 0040000000040100376389996
000009 0040000000040100427372996
000010 0040000000040100435375996

My Expected Output:

000001 0000000000000000000000
000005 0040000000040100152384996
000006 0040000000040100286372996
000007 0040000000040100295365996
000008 0040000000040100376389996
000009 0040000000040100427372996
000010 0040000000040100435375996

I dont want any of the duplicate records
I am using syncsort

using sort fields=none , i can only remove duplicates but it will copy first record of it.

In my case i dont want any duplicate records.

Please help me in this.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Jun 30, 2010 7:01 pm
Reply with quote

INREC insert a constant of 0001.
SORT on the key and SUM on the constant.
OUTREC OMIT where the summed constant is greater than one.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Jun 30, 2010 7:29 pm
Reply with quote

Good answer CICS guy.

Here we use the saying 'what is the vegas line for....'

In this case: what is the vegas line that the ts will ask for the syntax/code for same?

I make it better than even money at 1 to 2 (meaning you have to bet 2 dollars to win 1).
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Wed Jun 30, 2010 7:50 pm
Reply with quote

Quote:
what is the vegas line that the ts will ask for the syntax/code for same?



o ye of little faith

I won't take the bet though
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Jun 30, 2010 8:21 pm
Reply with quote

daveporcelan wrote:
Good answer CICS guy.
Thanks, I just point, mostly because that's how I learned.
Quote:
In this case: what is the vegas line that the ts will ask for the syntax/code for same?
I'll bet that he won't even have to ask...... icon_rolleyes.gif
Back to top
View user's profile Send private message
lagneshp

New User


Joined: 15 Aug 2009
Posts: 29
Location: Chennai

PostPosted: Thu Jul 01, 2010 8:41 pm
Reply with quote

Hi Guys,

Its good to sse that u bet on this

I executed with below code

//SYSIN DD *
INREC FIELDS=(1:1,25,26:C'001')
SORT FIELDS=(7,16,CH,A)
SUM FIELDS=(26,3,ZD)

//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(26,3,CH,GT,C'001')
/*

Its working fine..

Thanks,
See you with some other queries
.............................
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Jul 01, 2010 8:46 pm
Reply with quote

lagneshp,

You can include the OMIT in the OUTFIL of the first sort pass and avoid the need for a second pass.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Jul 06, 2010 2:15 pm
Reply with quote

Or else you can make use of the SYNCTOOL SELECT operator with NODUPS to get only unique values like this.
Code:
//STEP1 EXEC PGM=SYNCTOOL
//IN      DD DSN=Input file
//OUT     DD DSN=Output file
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//TOOLIN  DD *
  SELECT FROM(IN) TO(OUT) ON(7,16,CH) NODUPS
/*
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 Any JCL or VSAM Utility to get number... JCL & VSAM 1
No new posts Can we Insert duplicates in Primary U... DB2 2
No new posts SEPARATE UNIQUE and NON-UNIQUE in SEP... SYNCSORT 6
No new posts Unique IMS DB identifier IMS DB/DC 1
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... DFSORT/ICETOOL 2
Search our Forums:

Back to Top