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 and omit first record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ujwalavenu
Currently Banned

New User


Joined: 07 Feb 2006
Posts: 7
Location: Hyderabad

PostPosted: Tue Sep 26, 2006 5:07 pm    Post subject: Merge two files and omit first record
Reply with quote

Hi,

I need to Merge two files and write in to third file. I need to Omit the First Record in any File. In Input files first record is header. So i want to write only one time in to the output file.

Please help me.

Thanks and Regards,
Ujwala.
Back to top
View user's profile Send private message

Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Tue Sep 26, 2006 5:41 pm    Post subject: Re: Merge two files and omit first record
Reply with quote

What is the RECFM and LRECL of each input file?
What is the desired RECFM and LRECL of the output?
What is the key field that the MERGE will act on? What is it's type, position, and length?
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: Tue Sep 26, 2006 10:13 pm    Post subject:
Reply with quote

Ujwala,

In addition to answering Kevin's questions, please show an example of the records in each input file, and the records you expect for output.
Back to top
View user's profile Send private message
satishstar
Currently Banned

New User


Joined: 14 Mar 2005
Posts: 15

PostPosted: Wed Sep 27, 2006 12:02 am    Post subject: Re: Merge two files and omit first record
Reply with quote

Hi Ujwala,

Use this procedure :-

For merging the files and eliminating 1st record in both the files

//step010 exec pgm=syncsort
//sortin01 dd disp=shr,
// dsn=1st input file
//sortout dd disp=(new,catlg,delete),dsn= 1st output file
//sysin dd *
sort fields=copy,
SKIPREC=01
/*
//sysout dd sysout=*
//step020 exec pgm=syncsort
//sort01 dd disp=shr,
// dsn=2nd input file
//sortout dd disp=(new,catlg,delete),dsn=2nd output file
//sysin dd *
sort fields=copy,
SKIPREC=01
/*
//sysout dd sysout=*
//step030 exec pgm=syncsort
//sort01 dd disp=shr,
// dsn=1st output file
//sort02 dd disp=shr,
// dsn=2nd output file
//sortout dd disp=(new,catlg,delete),dsn=3rd output file(which contains merge of both files with in both input files first record being skipped)
//sysin dd *
sort fields=merge
/*
//sysout dd sysout=*
Back to top
View user's profile Send private message
jpsiddharth_007

New User


Joined: 27 Sep 2006
Posts: 1

PostPosted: Wed Sep 27, 2006 5:51 am    Post subject: Re: Merge two files and omit first record
Reply with quote

HI Ujawala,

Satish is rite..... but as u want ur first record to b in ur output file for once thn instead of skipping ur first record in both the files as mentioned by Satish... u can skip it only for one of the either files... I mean to say tht u can skip first record from either of the files instead of removing it from both the files............

hope u will get the desired output.
Back to top
View user's profile Send private message
ujwalavenu
Currently Banned

New User


Joined: 07 Feb 2006
Posts: 7
Location: Hyderabad

PostPosted: Wed Sep 27, 2006 6:55 am    Post subject: Re: Merge two files and omit first record
Reply with quote

Thanks for ur reply.

But my question is different. Please see below

I want to merge the two input files to one output file. All are fixed length files and all files contains length = 150

1) File1 - contains 10 records ( 1 header and 9 details records)
2) File2 - contains 10 records ( 1 header and 9 details records)
3) File3 - output file

I want to merge File1 and File2 to File3.

But I need to skip the header record from File2 (need to output only 9 detail records)

So after merge File3 must contains 19 records ( 10 from File1 and 9 from File2)

I want to use MERGE FIELDS = COPY
how to skip the header from File1.

Can I use an Omit cond.
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: Wed Sep 27, 2006 9:13 pm    Post subject:
Reply with quote

Quote:
Can I use an Omit cond.


That depends on what the header record looks like, which is why I asked you to show the records in your input files and the expected output records. If you had done that, I could have already showed you how to do what you want. If you want help, supply the requested information.

BTW, since you want to use MERGE FIELDS=COPY, you're doing a COPY, not a MERGE. There's a big difference. MERGE uses a key. COPY doesn't.
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 Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm


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