beber005 wrote:Ok thanks for your help it works

But why it's impossible to write directly in "Prolog" tab ?
It's not that you
can't write in the Prolog tab (and writing from the Prolog tab is not restricted to errors), it's just that there are two limitations. (Edit: Which Delcan just beat me to.)
The primary one is that each of the tabs (Prolog, Metadata, Data and Epilog) are regarded, in some sense, as being separate "sub-programs", if you like. What this means is that if you write a file of a specific name in the Prolog, and then do a further write to the same file in the Metadata, then the Metadata write will blow away the Prolog file and replace it with a completely new one.
If you then write to the same filename again in the Data tab, it will blow away the Metadata tab's file.
And, you guessed it, if you write to the same filename in the Epilog tab, it will blow away the file that you wrote in the Data tab.
The only way around this is to write to different file names and then use ExecuteCommand to run a batch file to merge them together. For the sort of thing that Declan has described that's an overcomplicated way of dealing with it; it's much easier to just follow his suggestion of writing the header row in the Data tab the first time you need to do the output.
It's fecking annoying and one of the features that many developers have wanted for ages (and which we see no signs of getting) is an
AsciiAppend function which would let us use the one file on all four tabs. If we ever get that you'll be able to write your header in the Prolog. In the meantime, better to follow Declan's advice.
The second thing is something that it appears from your post that you do in fact "get", but you need to get it very clear in your mind. The Prolog code,
all of the Prolog code, runs before the first row of the data file is even opened, much less read. It has to, because there are commands that you can use in the Prolog to change the data source to an entirely different file. The consequence of this is that you can
never use code in the Prolog tab to check for errors in the data source itself - you can only do that in the Metadata or Data tabs. The only error you can check for in the Prolog is whether the source file (assuming that your source is a text file) actually exists. If it doesn't, then you can write an error log and quit the process. But you can never check the contents of the file itself, not even the file headers, in the Prolog.