I am using the STM_FILE_Read / Transform_file to read the CSV file and create worklist. I had about 700+ records in the file and it stop at some record with bad data Cafe with the funny E. Any one know how to deal with funny character and force it to continue to read until the true EOF is reach? THANK!
I tried both:
use builtin(TRANSFORM_FILE) with_args(#WRKLIST #WK_String1 "O" "B") to_get(#RETNCODE)
this will stop at record 50, the Cafe is at record 68
use builtin(STM_FILE_READ) with_args(#FILENO) to_get(#wk_string1 #RETNCODE)
this stop right at 68 and jump out the DoUntil RetnCode=EF loop
Using STM_File_Read / Transform_File to process Text file
Re: Using STM_File_Read / Transform_File to process Text file
One thing you could try is saving and restoring the CSV file using the UTF-8 option.
To do that you use TRANSFORM_FILE and TRANSFORM_LIST, but you add a U to the format - e.g. in your case the format would be OU.
That might avoid the funny character problem.
To do that you use TRANSFORM_FILE and TRANSFORM_LIST, but you add a U to the format - e.g. in your case the format would be OU.
That might avoid the funny character problem.
Re: Using STM_File_Read / Transform_File to process Text file
Mark, Thanks for the Reply! I try removing all the funny characters in the CSV file the STM_File_Read read all the records, but transform_file only read the first 50 records
In the case that I have funny character in row 15, both operations will stop at 15
when i put the funny character in row 65, Transform_File still stop at 50, STM_File_Read stop at 65
Code: Select all
* Transform File
use builtin(TRANSFORM_FILE) with_args(#WRKLIST #WK_String1 "OU") to_get(#RETNCODE)
#wk_int6 := 0
selectlist named(#WRKLIST)
#wk_int6 += 1
#SYS_APPLN.TraceMessageText( ("Tranformed:[&1]->[&2][&3][&4][&5]").Substitute( #wk_Int6.AsString #ULOFID #ULTRAN #ULAMT.AsString #ULDESC ) )
endselect
* STM_File_Read
dountil cond('#retncode = EF')
use builtin(STM_FILE_READ) with_args(#FILENO) to_get(#wk_string2 #RETNCODE)
if cond('#retncode *EQ ER')
#SYS_APPLN.TraceMessageText( ("Read Error =[&1]").Substitute( #RETNCODE ) )
endif
if cond('#retncode *EQ OK')
#wk_Int6 += 1
#SYS_APPLN.TraceMessageText( ("Data Content=[&1:&2]").Substitute( #wk_int6.AsString #wk_String2 ) )
endif
enduntil
when i put the funny character in row 65, Transform_File still stop at 50, STM_File_Read stop at 65
Re: Using STM_File_Read / Transform_File to process Text file
Change the #WRKLIST entrys to *max, now the Transform_File works. Bad character issue remain unsolved!