Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merge two files, skipping header+trailer recs from one file
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: 3158
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 6:12 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 7:19 pm    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 7:40 pm    Post subject:
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 Moderator


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

PostPosted: Mon Jan 15, 2007 9:39 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us