ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
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? |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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)
/*
|
|
|