subroutine merge * get file types, and depending thereupon, call particular setup subroutine * depending on type, check for file consistency. Get time-ordering of input files * merge files and main extensions, using common merge subroutine, merge individual columns only when they exist in both datasets. * if type=events, call routines to (optionally) correct individual event file coordinates for small changes in RA, Dec and PA, then reproject sky positions onto single reference point on sky and calculate new WCS parameters. * if type=events, merge EXPOSURE and GTI extensions, using common merge subroutine, again checking for availability of extensions and columns * change header attributes where necessary, add history end subroutine merge