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

Compare two files using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Tue Aug 28, 2012 6:20 pm
Reply with quote

Hi,

I have an input fiel from diffrent dates .

File 1: Day 1

Code:
AAA RP
BBB SE
CCC XY
DDD RP
TTT  RP


File 2: Day 2
Code:
FFF RP
CCC RP
MMM RP
QQQ SE


I need to combine all teh files and remove the records that are having 'RP' in 4th byte. I can do this uisng Omit in sort. But i would also need to remove the records that was earlier with some other status like SE,XY but in future days have changed to 'RP. Form teh above files i need to remvoe the record "CCC XY" as well. Since on Day 1 it has "xy" but on days two it had "RP" so i need to remove those type of records as well. How can i achieve this.

Code'd
Back to top
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Tue Aug 28, 2012 6:51 pm
Reply with quote

Code:
File 1:
----+----1----+----2--
1111111111111111   PR
2222222222222222   RP
3333333333333333   ST
1243423433453453   PR

File 2:
----+----1----+----2--
1145353453454354   PR
2666666666666666   RP
3333333333333333   RP


this is the sample of how it looks. This is how my input fiels will be.and each day i will get one file. I will need to remvoe all the records from all teh files having the statsu as "RP" i will do this by omit cond eq "RP" but my question i should also be able to delte the reocrd that has record with status say "ST" or "PR" in day one but when on second or any other day if it is present in the file with Status "RP" then i should exclude them as well.

I now have idea to split them into two file one with recrods having "RP" status and file 2 with "ST","PR" and others. I should compare file 2 take the reocrd and see if it is in file 1 then i should drop them elase i shaoudl write them to output. but how to achieve that.
Back to top
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Tue Aug 28, 2012 8:34 pm
Reply with quote

The output file should be

File 1:
Code:
----+----1----+----2--
1111111111111111   PR
1243423433453453   PR
1145353453454354   PR


Code'd - I know you know how to do it
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Aug 28, 2012 11:56 pm
Reply with quote

vidyaa,

Please answer the following questions.

1. What is the LRECL and RECFM of File1?
2. What is the LRECL and RECFM of File2?
3. What is the position and format of the key to be matched in file1?
4. What is the position and format of the key to be matched in file2?
5. Where is the String 'RP' found in file1?
6. Where is the String 'RP' found in file2?
7. Run the sample job listed in this topic and show us the sysout which helps us to determine the level of DFSORT you running

ibmmainframes.com/viewtopic.php?t=33389
Back to top
View user's profile Send private message
vidyaa

New User


Joined: 02 May 2008
Posts: 77
Location: chennai

PostPosted: Fri Aug 31, 2012 11:13 am
Reply with quote

It is the same file of length 400....Except that file 1 has only RP and other fiel ahs all other statsu other than RP.and key is the first 16 bytes in both the files...
Th statsu RP,PR,ST are all in the postion 20 to 2 bytes....
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 Aug 31, 2012 12:35 pm
Reply with quote

So, to put it another way, for every record on FILE 1, which exclusively contains RPs, you want to remove all the keys from FILE 2 giving you FILE 3 with the remainder?

If this is so, it is very easy.

Use JOINKEYS, with UNPAIRED,F2,ONLY. Have a look in the manuals, look for examples of JOINKEYS here.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Aug 31, 2012 9:06 pm
Reply with quote

vidyaa wrote:
It is the same file of length 400....Except that file 1 has only RP and other fiel ahs all other statsu other than RP.and key is the first 16 bytes in both the files...
Th statsu RP,PR,ST are all in the postion 20 to 2 bytes....


Your earlier sample data shows that file1 has other data too apart from RP records. You need to be consistent with your requirements.
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 5
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top