Skip to content

Instantly share code, notes, and snippets.

@isc-rsingh
Last active November 19, 2019 15:56
Show Gist options
  • Save isc-rsingh/9a3288729012cd52ac4fec162335ed79 to your computer and use it in GitHub Desktop.
Save isc-rsingh/9a3288729012cd52ac4fec162335ed79 to your computer and use it in GitHub Desktop.
The simplest snippet to read from file in InterSystems Caché
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment