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

Need help with File Compare and Fields Comparision


IBM Mainframe Forums -> HomeWorks & Requests
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Sun Apr 16, 2023 10:04 pm
Reply with quote

Hi All,

I am currently working on a task, task is to compare two sorted files on key field and report report as below. If keys are matched then I need to compare FLD2, FLD4, FLD5 from both the files

Here is the sample input
Code:

[b]File 1 Data:
[/b]
KEY1 FLD1 FLD2 FLD3 FLD4 FLD6
---- ---- ---- ---- ---- ----
K001 F101 F201 F301 F402 F501
K002 F102 F202 F30X F40A F50X
K004 F10A F20X F304 F403 F505
K006 F10A F20X F304 F403 F505
K008 F10A F20X F304 F403 F505
     
[b]File 2 Data:[/b]

KEY1 FLD1 FLD2 FLD3 FLD4 FLD6
---- ---- ---- ---- ---- ----
K002 F101 F20A F301 F401 F501
K003 F102 F202 F30X F402 F50X
K004 F10A F20X F304 F403 F505
K005 F10A F20X F304 F403 F505
K008 F10A F20X F304 F403 F505


Expected output is:
Code:
K001                                 NOT FOUND IN FILE2

K002            FLD2                 NOT MATCHED
F202         F20A

K002            FLD4                 NOT MATCHED
F40A         F402

K003                                 NOT FOUND IN FILE1


Can we achieve this using ICETOOL/DFSORT? If yes, kindly guide me.

PS: Both the files are fixed length.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Mon Apr 17, 2023 4:51 pm
Reply with quote

Please, take one of THOUSANDS of existing examples, and TRY TO DO SOMETHING by yourself. Only in that case it can be discussed at this forum.

Your sample of input is not related in ANY MANNER to your sample of output data. At least it is not obvious.

Hints:
1) read about the statements JOINKEYS, JOIN, and REFORMAT
2) read about the parameters IFTHEN=, and WHEN=
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Thu Apr 20, 2023 1:26 pm
Reply with quote

Basically it's possible to do it using SORT. I am able to get the following results:
Code:
****** ***************************
000001 K001 Not found in F2       
000002 K002 FLD1 Not matched     
000003 F102 F101                 
000004 K002 FLD2 Not matched     
000005 F202 F20A                 
000006 K002 FLD3 Not matched     
000007 F30X F301                 
000008 K002 FLD4 Not matched     
000009 F40A F401                 
000010 K002 FLD5 Not matched     
000011 F50X F501                 
000012 K003 Not found in F1       
000013 K005 Not found in F1       
000014 K006 Not found in F2       
****** ***************************


Let us know if you need further help on this topic.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Apr 21, 2023 5:02 pm
Reply with quote

Moved to student section.
www.ibm.com/docs/en/zos/2.3.0?topic=files-joinkeys-statements
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Fri Apr 21, 2023 6:43 pm
Reply with quote

Hi All,

Apologies for the late reply.

I have started exploring JOINKEYS and REFORMAT in DFSORT to implement solution for my request, however, customer confirmed to write the code in COBOL so I am writing code in COBOL.

Thank you so much for your guidance.

Thanks,
Satish
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Sat Apr 22, 2023 2:21 am
Reply with quote

Okay thanks if you ever wonder how to do it using DFSORT then give it a try .. it’s better than cobol program and customer may like it too .
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Sun Apr 23, 2023 9:25 pm
Reply with quote

Also to mention, for the given sample, it's just a little more than 50 lines of SORT statements. The challenge is not the join operation itself, but the floating field comparison afterwards.
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 -> HomeWorks & Requests

 


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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top