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

Compare files


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

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Tue Mar 05, 2013 12:11 pm
Reply with quote

Hi All,

could someone please help me in solving this issue.

I need to compare two files and generate the report

1) File 1 is a VB file of lrecl 3504. The key is a PD field starts from position 10 to 19.

2) File 2 is a FB fie of LRECL 100. The key is a numeric and starts from position 20 to 35.

There should be 4 output,

1) Records should be pulled from file 1 where the key matches.
2) Records should be pulled from file-1 where the key is not matched.
3) Records should be pulled from file-2, where key matches.
4) Records should be pulled from file 2 where key doesnot match.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Mar 05, 2013 12:27 pm
Reply with quote

Quote:
1) File 1 is a VB file of lrecl 3504. The key is a PD field starts from position 10 to 19.

2) File 2 is a FB fie of LRECL 100. The key is a numeric and starts from position 20 to 35.

Are you sure the provided key is correct?
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: Tue Mar 05, 2013 12:53 pm
Reply with quote

Pandora, one PD one "numeric" (ZD).

Niki, how many output files is that, one, four, or something else?
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Tue Mar 05, 2013 12:54 pm
Reply with quote

The first file is of PD type and the position is 10 to 18 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: Tue Mar 05, 2013 4:09 pm
Reply with quote

And the answer to the next question is....?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Mar 05, 2013 11:44 pm
Reply with quote

Niki,

Joinkeys comparison keys will be treated as binary, so they must be "normalized". For example, if the keys are actually zoned decimal, they must have all C and D signs, or all F and D signs. You can use an INREC statement in JNF1CNTL and/or JNF2CNTL to normalize the keys for the F1 file and/or F2 file, respectively, if appropriate.

So in your case you need to "normalize" the PD key to ZD key or convert the ZD key to PD using JNF1CNTL or JNF2CNTL.

Look at the smart DFSORT trick "Create files with matching and non-matching records" here

www-01.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094

Give it a shot and get back to us if you have a problem.
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed Mar 06, 2013 9:11 am
Reply with quote

Thanks Skolusu. I will have a look into the sort trick documents.

Bill,

There should be 4 output files.


1) Records should be pulled from file 1 where the key matches.
2) Records should be pulled from file-1 where the key is not matched.
3) Records should be pulled from file-2, where key matches.
4) Records should be pulled from file 2 where key doesnot match.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Mar 06, 2013 9:42 am
Reply with quote

Niki,

Is there something you have tried ?
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed Mar 06, 2013 10:16 am
Reply with quote

Pandora,

In sort I tried to use the join functionality, by using splice operators but as the keys we are planning to compare are of different format always the job used to fail.

Finally I tried to achieve the same result by using the DYL code instead of Sort.

But the experience I have from this forum. I know one thing is that any file operation can be handled through SORT if there is some logic of operation.

Thanks again for helping me in all these days.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Mar 07, 2013 12:21 am
Reply with quote

Niki wrote:
In sort I tried to use the join functionality, by using splice operators but as the keys we are planning to compare are of different format always the job used to fail.


Why are you using SPLICE? We have shown enough examples for you about using JOINKEYS. Can't you take them as examples and build your JCL?


Niki wrote:

But the experience I have from this forum. I know one thing is that any file operation can be handled through SORT if there is some logic of operation. Thanks again for helping me in all these days.


You need to understand the examples shown here and try to apply the same logic to your other jobs. The request is you have is fairly simple request and can be done very easily. The actual Sort control cards are just 11 lines. Anyway it is a moot point since you already have written a program.
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: Thu Mar 07, 2013 1:10 am
Reply with quote

Niki,

You have an FB and a VB. You need to arrange the keys such that they are both the same format. So, easiest/fewest resources is to OVERLAY the "numeric" key at position 101 to a PD of the correct length. This is done in JNFnCNTL, where "n" is the "number of the file".

Do the JOINKEYS with the original PD key and the new PD key.

Specify that you require matched and unmatched records (from both files).

The thing to watch on the REFORMAT statement is to both make the REFORMAT record variable and put the "variable part" of the VB as the last thing on the REFORMAT definition.

Use 4 X OUTFIL with INCLUDE/OMIT for the "matching values" of the ? from the REFORMAT statement. Use BUILD on each to get the correct and appropriate data for that output file.

If we keep just providing code to you, you'll keep coming back, without, it seems, the inclination to learn how to do anything new.

So, have a go. If you get stuck, there'll be someone here.
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 and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top