View previous topic :: View next topic
|
Author |
Message |
abraralum
New User
Joined: 19 Dec 2010 Posts: 42 Location: Bangalore
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
abraralum
New User
Joined: 19 Dec 2010 Posts: 42 Location: Bangalore
|
|
|
|
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 |
|
|
abraralum
New User
Joined: 19 Dec 2010 Posts: 42 Location: Bangalore
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
STFF Yourself please |
|
Back to top |
|
|
abraralum
New User
Joined: 19 Dec 2010 Posts: 42 Location: Bangalore
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
abraralum
New User
Joined: 19 Dec 2010 Posts: 42 Location: Bangalore
|
|
|
|
Thanks Bill, I will try with USING(...) command. |
|
Back to top |
|
|
|