1. Do the files have RECFM=FB or RECFM=VB? If the files have RECFM=FB then you cannot "merge" (or "copy") them in one pass, but you can do it in one step with DFSORT's ICETOOL. If the files have RECFM=VB, you can "merge" (or "copy") them in one pass.
However, it's not clear if you really want to "merge" which would involve a key on which both files were previously sorted, or just copy them one after the other. Tell me which it is and the RECFM and I'll show you how to do it with ICETOOL (if you really want to merge, also tell me the starting position, length and format of the key).
2. You can use a DFSORT job like the following for that:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
123A001XXXXXXXXXX
3424A002sjkXXXXXXX
14A003sjkXXXXXXXXX
15645A004XXXXXXXXX
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC PARSE=(%01=(STARTAT=C'A',FIXLEN=4)),
BUILD=(%01)
/*
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
http://www.ibm.com/support/docview.wss? ... g3T7000080