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 keeping last record of first file intact.

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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Sep 15, 2011 4:34 am    Post subject: Merge two files keeping last record of first file intact.
Reply with quote

Hi,

I have two sequential files both having FB LRECL=975.

The first file contains record in this format:
The Header record always starts with ##H and Trailer with ##T. There would be no other records in both the files having ## in the first 2 positions other than the header and the trailer record.

##H <Header Record>
data1
:
:
data1
##T <Trailer Record>

And the second file just have data; no header or trailer records.

Now, I want to merge both the files as below keeping the trailer position as it is:

##H <Header Record>
data1
:
:
data1
data2 --data from second file
:
:
data2
##T <Trailer Record>

Could somebody please advise me if there are any sort cards to achieve the same?
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: Thu Sep 15, 2011 4:48 am    Post subject:
Reply with quote

I think you mean "concatenate" rather than "merge" (MERGE would imply that the records in each file are in order by a specific key which I don't think is the case here).

At any rate, here's a DFSORT job that will do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/975)
//       DD DSN=...  input file2 (FB/975)
//SORTOUT DD DSN=...  output file (FB/975)
//SYSIN DD *
  OPTION EQUALS
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(976:C'##I')),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'##'),OVERLAY=(976:1,3))
  SORT FIELDS=(976,3,CH,A)
  OUTREC BUILD=(1,975)
/*

Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Sep 15, 2011 8:25 pm    Post subject:
Reply with quote

It worked great!! Thank You Frank.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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