We can achieve this by using the Sort Join (in a JCL). The following steps in a sort card will move all the records from the two files having the same emp no into the third file:
STEP001 SORT
SORTNJF1 DD DSN INPUT1 DISP SHR
SORTNJF2 DD DSN INPUT2 DISP SHR
SORTOF1 DD DSN OUTPUT1 DISP (NEW CATLG DELETE)
SYSIN DD *
JOINKEYS FILE1 (1 3 CH) --Assuming emp no is of len 3 starting in position 1 of file1
JOINKEYS FILE2 (1 3 CH) --Assuming emp no is of len 3 starting in position 1 of file2
REFORMAT FIELDS (F1:1 100 F2:4 50) -- copies the rcords from both the input files into the output (from pos 1 of i/p file1 and position 4 of i/p file2
SORT FIELDS (1 3 CH A) -- sorts the output file based on the empno
OUTFIL FILES 1
/*