View previous topic :: View next topic
|
Author |
Message |
clearskynot
New User
Joined: 21 Apr 2010 Posts: 7 Location: USA
|
|
|
|
Hi..
I have a daily file and a month to date file. The daily file has a header record. The data in the daily file will be appended to the MTD file on a daily basis. But i want only one header record in the MTD file at any point of time.
These are flat files with rec length of 274 and i dont want to re-order the data after appending the data.
Ex:
daily file:
------------
PART,PLACE,TRANS CODE,TRANS DATE,
A11223,SFO,GIVE,12MAR2010
MTD FILE:
----------------
PART,PLACE,TRANS CODE,TRANS DATE,
A11220,NYC,GET,10MAR2010
A10223,MOC,GIFT,11MAR2010
Please help me out.
Thanks |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Initialize MTD file at start with the required header record.
Then after for every append process omit first record from daily file.
To get exact solution,
1: you need to tell which sort product you are using at your shop?
2: will daily file have always first record as identifier /will it always have same hardcoded data as u mentioned (PART,PLACE,TRANS CODE,TRANS DATE, ) at header?
Sorry Got the answer of first question. May be I didnt see the full subject properly.
Now second |
|
Back to top |
|
|
Corey Hardy
New User
Joined: 14 Apr 2010 Posts: 9 Location: Virginia
|
|
|
|
Code: |
SORT FIELDS=COPY,SKIPREC=1
|
...Sorry, the above will not work because the second header is going to be in the middle of the file. |
|
Back to top |
|
|
Corey Hardy
New User
Joined: 14 Apr 2010 Posts: 9 Location: Virginia
|
|
|
|
Here is a two step solution:
Step One: OMIT HEADER FROM MTD FILE
Code: |
//STEP01 EXEC PGM=SORT,COND=(0,LT)
//SYSIN DD *
SORT FIELDS=COPY,SKIPREC=1
//*
//SORTIN DD DSN=MTD.FILE,DISP=SHR
//SORTOUT DD DSN=MTD.FILE.OUT,DISP=SHR
|
Step Two: CONCATENATE DAILY AND MTD FILES
Code: |
//STEP02 EXEC PGM=SORT,COND=(0,LT)
//SYSIN DD *
SORT FIELDS=COPY
//SORTIN DD DSN=DAILY.FILE,DISP=SHR
// DD DSN=MTD.FILE.OUT,DISP=SHR
//*
//SORTOUT DD DSN=COMBINED.FILE,DISP=(NEW,CATLG,DELETE)
|
|
|
Back to top |
|
|
clearskynot
New User
Joined: 21 Apr 2010 Posts: 7 Location: USA
|
|
|
|
Escapa wrote: |
Initialize MTD file at start with the required header record.
Then after for every append process omit first record from daily file.
To get exact solution,
1: you need to tell which sort product you are using at your shop?
2: will daily file have always first record as identifier /will it always have same hardcoded data as u mentioned (PART,PLACE,TRANS CODE,TRANS DATE, ) at header?
Sorry Got the answer of first question. May be I didnt see the full subject properly.
Now second |
The daily file can be empty also on some day.. it will not have a header if it is empty..
so skiprec is not adviceable..
and i donot want to initialize the MTD file with a header alone |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
and i donot want to initialize the MTD file with a header alone |
Why not?
Meeting the business requirement with a proper implementaton is a better alternative than than merely meeting a developer's personal preference. . . |
|
Back to top |
|
|
|