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
 

 

Is it possible to remove similar records

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

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Fri Dec 07, 2012 5:32 pm    Post subject: Is it possible to remove similar records
Reply with quote

Hi,

I have data like below in file1:

Code:
Test_rec1File1
Test_rec1data1
Test_rec1data2
Test_rec2File2
Test_rec2data3


In File2:
Code:
Test_rec1File1
Test_rec1data1
Test_rec1data2
Test_rec1data3


The output should be like:
Code:
Test_rec1data1
Test_rec1data2
Test_rec2data3
Test_rec1data1
Test_rec1data2
Test_rec1data3


It is being sorted on First 9 characters. Pointers please.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Dec 07, 2012 5:55 pm    Post subject: Reply to: Is it possible to remove similar records
Reply with quote

Your output shows the "File" records missing. Is it as simple as that and getting the order you want, which seems to be all the first file first and the second file second?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Dec 07, 2012 5:58 pm    Post subject:
Reply with quote

Yes, It is possible but only when you give complete information.
Test_rec1File1
Above looks like header, how it is identified? Any literal available at this record to identify?

For me it simply looks like appending both files togather with removing type of records I mentioned above.
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Fri Dec 07, 2012 6:02 pm    Post subject:
Reply with quote

Bill,

The output shouldn't contain the "File" record. These records to be removed (if with duplicates or no duplicates).

Apologies, here the output should be like:
Code:
Test_rec1data1
Test_rec1data2
Test_rec1data1
Test_rec1data2
Test_rec1data3
Test_rec2data3
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Fri Dec 07, 2012 6:11 pm    Post subject:
Reply with quote

Escapa,

Sorry for not being clear on the query.

No it is not a header record. It is identified with the first 9 characters of the records. If the 9 chars are similar then the records "Test_rec1File1" or "Test_rec1File2" should be removed and the rest should be copied as below:

Code:
Test_rec1data1
Test_rec1data2
Test_rec1data1
Test_rec1data2
Test_rec1data3
Test_rec2data3
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Dec 07, 2012 6:23 pm    Post subject: Reply to: Is it possible to remove similar records
Reply with quote

abraralum,

Sorry, but I still don't follow.

You want to get rid of the "File" records and have them take no further part in the processing, or not?

What gives you that particular order?

What do you mean by "similar"?

Can you extend your sample data to show records which should be retained and records which should be excluded, and the expected output?

Have you tried anything?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Dec 07, 2012 6:36 pm    Post subject:
Reply with quote

You are not explaining requirements better.... Let us know back if this is working as per your expectation..
Code:

//STEP100  EXEC PGM=SORT
//SORTIN   DD  *
TEST_REC1FILE1
TEST_REC1DATA1
TEST_REC1DATA2
TEST_REC2FILE2
TEST_REC2DATA3
//         DD  *
TEST_REC1FILE1
TEST_REC1DATA1
TEST_REC1DATA2
TEST_REC1DATA3
//SORTOUT  DD  SYSOUT=*
//SYSIN    DD  *
  SORT FIELDS=COPY
  OMIT COND=(10,4,CH,EQ,C'FILE')
/*
//SYSOUT   DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*

Output
Code:

TEST_REC1DATA1
TEST_REC1DATA2
TEST_REC2DATA3
TEST_REC1DATA1
TEST_REC1DATA2
TEST_REC1DATA3
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Dec 07, 2012 6:44 pm    Post subject: Reply to: Is it possible to remove similar records
Reply with quote

Quote:
Pointers please.


STFF Yourself please icon_cool.gif
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Fri Dec 07, 2012 7:28 pm    Post subject:
Reply with quote

I will try to explain better.

Code:

Test_rec1File1  --> Master record
Test_rec1data1 --> Group Record
Test_rec1data2  --> Group Record
Test_rec1data3  --> Group Record
Test_rec2File2  --> Master record
Test_rec2data3  --> Group Record

Test_rec1File1 --> Master record
Test_rec1data1  --> Group Record
Test_rec1data2  --> Group Record
Test_rec2File2 --> Master record
Test_rec2data4 --> Group Record


Now I have achieved getting the data in the below order:
Code:

Test_rec1File1  --> Master record
Test_rec1data1 --> Group Record
Test_rec1data2  --> Group Record
Test_rec1data3  --> Group Record
Test_rec1data1  --> Group Record
Test_rec1data2  --> Group Record
Test_rec2data3  --> Group Record
Test_rec2data4 --> Group Record



Here since Master record "Test_rec1File1" having duplicates, this record is kept as it is. But this should be removed. This is donse using the below:

Code:

SPLICE FROM(TEMP) TO(OUT) ON(01,09,CH) KEEPNODUPS -
   WITH(10,5) WITHALL                                 


Initially I thought, we can remove this record with sum fileds like command, but it can not, so was the query was not clear. Sorry, for wasting your time..
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Dec 07, 2012 7:41 pm    Post subject: Reply to: Is it possible to remove similar records
Reply with quote

If you want to stick with the SPLICE, why don't you use USING(...) and have a CNTL file containing OMIT for the File records?

I'm sure that if you explained everything, JOINKEYS would give you a better solution.
Back to top
View user's profile Send private message
abraralum

New User


Joined: 19 Dec 2010
Posts: 42
Location: Bangalore

PostPosted: Fri Dec 07, 2012 8:02 pm    Post subject:
Reply with quote

Thanks Bill, I will try with USING(...) command.
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
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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