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
 

 

Eliminate duplicate based on condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue May 05, 2009 12:59 pm    Post subject: Eliminate duplicate based on condition
Reply with quote

I have an input file and i need the output to have unique records based on 2 conditions.

Ex

Output File looks like this

Code:

111-22-3333AB3045000
111-22-3333XX2345000
121-22-3333CB3045000
131-22-3333DB3045000


Output File should have only

111-22-3333AB3045000
121-22-3333CB3045000
131-22-3333DB3045000

The output was filtered on 2 conditions - on the SSN and the amount(here it is 45000) on a specified field. Since rec 1 and rec 2 were not exactly duplicates but were duplicates in these 2 fields (SSN and the amount 45000)

I cannot use Sum fields = none in this case.

Please advise.
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 May 05, 2009 1:03 pm    Post subject:
Reply with quote

Hello,

Quote:
I cannot use Sum fields = none in this case.
Please clarify.

What happens when you run a test with SUM FIELDS=NONE?

Post the jcl and control statements and the informational messages generated by the run. Include the message ids.
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue May 05, 2009 1:14 pm    Post subject:
Reply with quote

Hi,

when i use Sum fields=none it gives the output as

Code:

111-22-3333AB3045000
111-22-3333XX2345000
121-22-3333CB3045000
131-22-3333DB3045000


So that doesnt help. Can you advise on how to eliminate the duplicate records if the same value is appearing on a particular field?
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 May 05, 2009 1:17 pm    Post subject:
Reply with quote

Hello,

To repeat. . . .
Quote:
Post the jcl and control statements and the informational messages generated by the run. Include the message ids.
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue May 05, 2009 1:22 pm    Post subject:
Reply with quote

I am sorry i am not allowed to disclose JCL information. I have a requirement and i need to know how to go about it.
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 May 05, 2009 1:37 pm    Post subject:
Reply with quote

Hello,

Quote:
I am sorry i am not allowed to disclose JCL information.
Maybe not the "real" jcl, but you could make a copy with the names changed. There is no reason to not post the sort control statements and the messages/ids generated by the run.

If you are unwilling to provide info to help yourself, you may have a longer wait for help icon_confused.gif
Back to top
View user's profile Send private message
CJT

New User


Joined: 02 Aug 2007
Posts: 83
Location: Here

PostPosted: Tue May 05, 2009 2:40 pm    Post subject: Reply to: Eliminate duplicate based on condition
Reply with quote

I got the output using

SORT FIELDS=(13,11,CH,A,47,13,ZD,A)
SUM FIELDS=NONE
Back to top
View user's profile Send private message
dominickim

New User


Joined: 28 Feb 2007
Posts: 65
Location: NS, CA

PostPosted: Tue May 05, 2009 7:10 pm    Post subject: I am not sure what is your problem.
Reply with quote

Code:
    000300    //S1      EXEC PGM=SORT                 
    000400    //SYSPRINT  DD SYSOUT=*                 
    000500    //SYSOUT    DD SYSOUT=*                 
    000600    //SORTLIB   DD DSN=SYS1.SORTLIB,DISP=SHR
    000700    //SORTIN    DD *                         
    =COLS>    ----+----1----+----2----+----3----+----4-
    000800    111-22-3333AB3045000                     
    000900    111-22-3333XX2345000                     
    001000    121-22-3333CB3045000                     
    001100    131-22-3333DB3045000                     
    002700    /*                                          
    002800    //SORTOUT   DD SYSOUT=*                 
    002900    //SYSIN     DD *                         
    003000     SORT FIELDS=(1,11,CH,A,16,5,ZD,A)       
    003100     SUM FIELDS=NONE                         
    003200    /*                                       

Output
Code:
111-22-3333AB3045000
121-22-3333CB3045000
131-22-3333DB3045000
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 May 05, 2009 9:00 pm    Post subject:
Reply with quote

Hello,

Quote:
I got the output using

SORT FIELDS=(13,11,CH,A,47,13,ZD,A)
SUM FIELDS=NONE
Good to hear this is working icon_smile.gif

Why was the original attempt with SUM FIELDS=NONE unsuccessful?
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: Tue May 05, 2009 9:21 pm    Post subject:
Reply with quote

Quote:
The output was filtered on 2 conditions - on the SSN and the amount(here it is 45000) on a specified field. Since rec 1 and rec 2 were not exactly duplicates but were duplicates in these 2 fields (SSN and the amount 45000)

I cannot use Sum fields = none in this case.


This statement makes no sense. Records are duplicates or not depending on whether the SORT fields you specify match. If you specify the two fields you're interested in as the SORT fields, then SUM FIELDS=NONE will only keep one of the duplicates for those matching fields. The fields you don't specify as SORT fields don't have any effect on whether the records are considered to be duplicates.
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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