I have two files, with this layout:
data records (1-many)
trailer record (1)
I want to merge them, en skip the header & trailer from one of the files.
The end result should then have the same layout as the input files(e.g. one header and trailer record, and all the other data records included).
The header and trailer records can be recognized by the first 20 positions filled with resp. 00000000 or 999999999
I did look. But I could not find something useful. The only examples were on single include/omit params. That is, when using OUTFIL FILES=x option.
With a normal SORT you can code INCLUDE COND=...... and then using AND, OR to indicate what you want to include.
I did succeed in doing it in multiple steps. What I did was first split the output in one large data-record-only file, and another file containing the header and trailerrecs. Then removing the double entries from the second file, and merging them again.
I was hoping that there was some kind of more efficient method.
Here's a DFSORT/ICETOOL job that will do what I think you asked for.
Be sure to use a MOD data set for //OUT.
It wasn't clear from what you said, but I assumed the header had 20 C'0's and the trailer had 20 C'0's. If not, change the OMIT statements accordingly.
I assumed you wanted to "copy" the detail records from file1 and then from file2, and not actually "merge" them on a key. If you actually want to "merge" the files on a key, what is the starting position, length and format of the key?
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: