View previous topic :: View next topic
|
Author |
Message |
Nighthawk750
New User
Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
Hello,
I have two files, with this layout:
header (1)
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 |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Have you looked at the DFSORT manual? I think I recall where you can include/omit uniquely on different inputs....
I don't see that for Syncsort, I think it will take two passes. |
|
Back to top |
|
|
Nighthawk750
New User
Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
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.
Regards,
Marc |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Well, I would have copied the smaller to temp omitting its header and trailer and then merged both to final...
I just looked and ICETOOL looks like it will do it in one step, but i think it would involve sorting rather than just merging. |
|
Back to top |
|
|
Nighthawk750
New User
Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
If a sort in included, that is no problem. That should also occur.
I never have used the ICETOOL....can you give me an example of how my sort would look like? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Do you have DFSORT?
Do you have the manual? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Nighthawk,
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?
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//OUT DD DISP=MOD,DSN=... MOD output file
//TOOLIN DD *
COPY FROM(IN1) TO(OUT) USING(CTL1)
COPY FROM(IN2) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
* Copy file1 header record and detail records -
* omit trailer record.
OMIT COND=(1,20,CH,EQ,C'99999999999999999999')
/*
//CTL2CNTL DD *
* Copy file2 detail records and trailer record -
* omit header record.
OMIT COND=(1,20,CH,EQ,C'00000000000000000000')
/*
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Nighthawk750
New User
Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
Thanks alot!
I am familiar with the "normal" sort. I did not use ICETOOL before. I will work my way through the "Getting Started" as you suggested.
Regards,
Marc |
|
Back to top |
|
|
|