Hi!
I believe the simplest is (to work with csv delimited by ";"):
set file = ##class(%File).%New( "data.csv" )
set sc = file.Open( "R" )
if $$$ISERR(sc) quit ; or do smth
while 'file.AtEnd {
set str=file.ReadLine()
for i=1:1:$length( str, ";" ) {
set id=$piece( str, ";" ,i )
write !, id // or do smth
}
}
do file.Close()
Possible options:
different variants of error handling with sc code.
Embrace while loop into try/catch block.
And what's yours?