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

Is it possible to remove similar records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri Dec 07, 2012 5:55 pm
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
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
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
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

Moderator Emeritus


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

PostPosted: Fri Dec 07, 2012 6:23 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Dec 07, 2012 6:44 pm
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
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

Moderator Emeritus


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

PostPosted: Fri Dec 07, 2012 7:41 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top