The merging of files is done by using the CPYF (Copy File) command and specifying the *ADD option to append the data from one file to another:
CPYF FROMFILE(A) TOFILE(B) MBROPT(*ADD) FMTOPT(xxx)
The FMTOPT parameter tells the system how to do the copy, for example:
FMTOPT(*NOCHK) means copy left to right, character by character.
FMTOPT(*MAP) means only copy fields with the same names in both files. Any fields in the TOFILE that aren’t in the FROMFILE are initialised with default values.
There are many other parameters for the command which allow you to only copy a selection of records, etc, but this should get you started.
All the best
Or merging files is done with the MRGSRC command (or PDM option 55). Normal help text for the command describes a main use — merging updates into source members.