SORT for 2 files

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Masquerador_93
Member
Posts: 4
Joined: Tue Oct 25, 2016 9:28 pm

SORT for 2 files

Post by Masquerador_93 » Tue Oct 25, 2016 9:39 pm

Hi I need to compare two files using SORT utility like...

File 1
id name no time date address bala
1 sdbskafjo 456 12 12302009 nejfirejt 1000
2 narjweop 678 24 12312010 dfngijreo 2000
4 mnjdjhdj 956 08 12082012 asefgrg 950

File2
id name no time date address bala
1 sdbskafjo 456 12 12302009 nejfirejt 200
2 narjweop 678 24 12312010 dfngijreo 300
3 abcdefgh 362 15 12302010 asdafggf 80


Now I want the o/p as..

id name Time no date address bala
1 sdbskafjo 12 456 12302009 nejfirejt 800
2 narjweop 24 678 12312010 dfngijreo 1700
4 mnjdjhdj 956 08 12082012 asefgrg 950
3 abcdefgh 362 15 12302010 asdafggf 80

Here we have to rearrange one of the column field in the output (like time & no have been interchanged) and also the difference between the last column for a match has to be obtained.
Comparison is done between all the columns (id, name, no , time,date and address) except the bala column.

Masquerador_93
Member
Posts: 4
Joined: Tue Oct 25, 2016 9:28 pm

Post by Masquerador_93 » Tue Nov 08, 2016 2:59 pm

Somebody please help me with this!!!

magesh_j
Member
Posts: 16
Joined: Wed Aug 31, 2016 8:32 am

Post by magesh_j » Thu Nov 17, 2016 9:53 pm

Start using code tag like below

Code: Select all

1 SDBSKAFJO 456 12 12302009 NEJFIREJT 1000
2 NARJWEOP  678 24 12312010 DFNGIJREO 2000
4 MNJDJHDJ  956 08 12082012 ASEFGRG   950 

Code: Select all

1 SDBSKAFJO 456 12 12302009 NEJFIREJT 200     
2 NARJWEOP  678 24 12312010 DFNGIJREO 300     
3 ABCDEFGH  362 15 12302010 ASDAFGGF  80      
what should be the output if there is a mismatch in any of the column.

Thanks
Magesh

Masquerador_93
Member
Posts: 4
Joined: Tue Oct 25, 2016 9:28 pm

Post by Masquerador_93 » Wed Nov 23, 2016 6:33 pm

Hi Magesh

Code: Select all

1 SDBSKAFJO 456 12 12302009 NEJFIREJT 800
2 NARJWEOP  678 24 12312010 DFNGIJREO 1700 
4 MNJDJHDJ  956 08 12082012 ASEFGRG   950
3 ABCDEFGH  362 15 12302010 ASDAFGGF  80  
Mismatch in any of the column will be a new entry in the output file.

Thanks.

you must also UNCHECK the Disable BBCODE

Masquerador_93
Member
Posts: 4
Joined: Tue Oct 25, 2016 9:28 pm

Post by Masquerador_93 » Mon Jan 02, 2017 4:21 pm

Any help with this one??!!

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others