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
 

 

Removing duplicate headers in a flat file using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
clearskynot

New User


Joined: 21 Apr 2010
Posts: 2
Location: USA

PostPosted: Wed Apr 21, 2010 11:42 am    Post subject: Removing duplicate headers in a flat file using Syncsort
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    Post subject:
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    Post subject: Reply to: Removing duplicate headers in a flat file using Sy
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    Post subject:
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: 2
Location: USA

PostPosted: Wed Apr 21, 2010 10:41 pm    Post subject:
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

Site Director


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

PostPosted: Wed Apr 21, 2010 11:13 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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