how to define and use dynamic delimiter when using import Statement

sharkdim

Member
my program :

define variable file_sep as character format "x(1)" no-undo.
DEFINE VARIABLE aaa AS CHARACTER.
DEFINE VARIABLE bbb AS CHARACTER.
DEFINE VARIABLE ccc AS CHARACTER.
ASSIGN file_sep = "|".
input from d:\bbb.txt.
REPEAT:
import delimiter file_sep aaa bbb ccc NO-ERROR.
MESSAGE aaa bbb ccc.
END.
========================
d:\bbb.txt :
"010000"|"010001"|"a"
"010000"|"010001"|"b"

========================
when i run these code ,progress editor give me the error " Invalid statement. (254)"

i want to import a file use a dynamic delimiter which can be defined in control
 
import delimiter file_sep" aaa bbb ccc NO-ERROR.

You have a syntax error in your code. The double quote marks the beginning of a string but you don't terminate it accordingly - that's what the compiler claims about. You need to remove the double quote.

Heavy Regards, RealHeavyDude.
 
sorry , it's input error , i have changed the thread , after remove double quote , the error "Invalid statement. (254)" is also displayed
 
That is correct. It is not possible to dynamically specify the delimiter.

I've been frustrated by that myself from time to time.
 
As it says sharkdim, you could import an entire line at a time and then manage your variables easily with NUM-ENTRIES and ENTRY functions..
 
Back
Top