IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merge two files, skipping header+trailer recs from one file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Jan 15, 2007 5:58 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 6:12 pm
Reply with quote

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
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Jan 15, 2007 6:51 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 7:19 pm
Reply with quote

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
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Jan 15, 2007 7:30 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 7:40 pm
Reply with quote

Do you have DFSORT?
Do you have the manual?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 15, 2007 9:39 pm
Reply with quote

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
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Tue Jan 16, 2007 1:29 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top