hi everyone, i have to import a textfile with fields with fixed lenght.
I can't use dataports for a couple of reasons, so i have started to work with the well known loop
WHILE lFLFile.POS < lINTFileLen DO BEGIN
lFLFile.READ(lTXTLine);
FunctionToModifyTheTable(lTXTLine);
END;
lFLFile.CLOSE;
FunctionToModifyTheTable(ptxtline):
...
EVALUATE("Posting Date",COPYSTR(pTXTLine,50,8));
...
as you can see, i've had to hardcode the startpos and len of the piece of string...which means that if the file changes it's an hard work to do

Do someone have already avoided this issue? if so, Can you share the code with us, please?
P.S.: i thought to use integers and calculate dynamically the startpos based on the width...but i risk to clutter the code with a lot of variables or declare a not self documenting array...
Thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Comments
Maybe only the way is to use separators in text files, but I think You would do it if it is possible...
my colleague suggest me to split the lines like this
and then assign the variables to the fields (i can't do it in one go because i read and set the values not in the order they're written in the file.
It's not so bad...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
IF pTXTLine[1] = 'H' THEN BEGIN
and
IF pTXTLine[1] = 'M' THEN BEGIN
lines
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog