IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Removing duplicate headers in a flat file using Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
clearskynot

New User


Joined: 21 Apr 2010
Posts: 7
Location: USA

PostPosted: Wed Apr 21, 2010 11:42 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Apr 21, 2010 3:31 pm
Reply with quote

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
View user's profile Send private message
Corey Hardy

New User


Joined: 14 Apr 2010
Posts: 9
Location: Virginia

PostPosted: Wed Apr 21, 2010 7:51 pm
Reply with quote

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
View user's profile Send private message
Corey Hardy

New User


Joined: 14 Apr 2010
Posts: 9
Location: Virginia

PostPosted: Wed Apr 21, 2010 8:32 pm
Reply with quote

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
View user's profile Send private message
clearskynot

New User


Joined: 21 Apr 2010
Posts: 7
Location: USA

PostPosted: Wed Apr 21, 2010 10:41 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 21, 2010 11:13 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top