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
 

 

Retain only unique reccords

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Retain only unique reccords
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Jun 30, 2010 1:08 pm    Post subject: Reply to: Retain only unique reccords
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Jun 30, 2010 1:47 pm    Post subject: Reply to: Retain only unique reccords
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    Post subject: Reply to: Retain only unique reccords
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: 2150
Location: At my coffee table

PostPosted: Wed Jun 30, 2010 7:01 pm    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Wed Jun 30, 2010 7:29 pm    Post subject:
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: 236
Location: Cincinnati OH USA

PostPosted: Wed Jun 30, 2010 7:50 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Jun 30, 2010 8:21 pm    Post subject:
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    Post subject: Reply to: Retain only unique reccords
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: 2150
Location: At my coffee table

PostPosted: Thu Jul 01, 2010 8:46 pm    Post subject:
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: 2158
Location: @my desk

PostPosted: Tue Jul 06, 2010 2:15 pm    Post subject:
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    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
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Unique sort situation.... dbecker SYNCSORT 6 Wed Apr 27, 2016 8:53 pm
No new posts Unique Record Count anandhan87 DFSORT/ICETOOL 1 Tue Feb 09, 2016 4:06 pm
No new posts SAS - RETAIN statement Musab Ahmed IBM Tools 2 Thu Jan 28, 2016 1:02 pm


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