Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare two files using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compare two files using sort
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Compare two files using sort
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

http://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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Fri Aug 31, 2012 12:35 pm    Post subject: Reply to: Compare two files using sort
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    Post subject:
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    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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us