Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compare files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Tue Mar 05, 2013 12:11 pm    Post subject: Compare files
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

Moderator


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

PostPosted: Tue Mar 05, 2013 12:27 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Mar 05, 2013 12:53 pm    Post subject: Reply to: Compare files
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: 102
Location: Bangalore

PostPosted: Tue Mar 05, 2013 12:54 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Mar 05, 2013 4:09 pm    Post subject: Reply to: Compare files
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    Post subject:
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

http://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: 102
Location: Bangalore

PostPosted: Wed Mar 06, 2013 9:11 am    Post subject:
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

Moderator


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

PostPosted: Wed Mar 06, 2013 9:42 am    Post subject:
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: 102
Location: Bangalore

PostPosted: Wed Mar 06, 2013 10:16 am    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Mar 07, 2013 1:10 am    Post subject: Reply to: Compare files
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    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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us