Adding Header to a file using eScript (Doc ID 490919.1)

Last updated on MARCH 02, 2017

Applies to:

Siebel Tools - Version 7.7.2 [18325] to 8.1.1 [21112] [Release V7 to V8]
z*OBSOLETE: Microsoft Windows Server 2003
Product Release: V7 (Enterprise)
Version: 7.7.2 [18325]
Database: Oracle 8.1.7.4
Application Server OS: Microsoft Windows 2003 Server
Database Server OS: IBM AIX 4.2

This document was previously published as Siebel SR 38-2724657621.
***Checked for relevance on 03-Jan-2014***

Symptoms

Hi,
I am trying to read a file using "Read CSV File" BS. For that i had to provide the Integration Object Name and Integration Object Component.Field Names as a header. Since i am not being provided with the header, i have write the header to the file using a eScript before passing it on to the "Read CSV File" BS.
I used the following code for that:

var sFileName = "C:\\CampaignFiles\\FixLoadFiles\\test.txt";
var fp = Clib.fopen(sFileName,'r+');
Clib.rewind(fp);
Clib.fprintf(fp,"#Princess Mrkt Marketing Camp Con CCN" + "\n" + "#Marketing Camp Con.CCN" + "\n");
Clib.fclose(fp);

The code behaves as follows:
It removes the first few lines of the file and then writes the header i provided.
If i open the File with the "a" mode, it writes the header string at the end of file.
Please advice be what to do. It is very urgent. Please find the files with and without header in the attachments

Thanks

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms