Last active
November 19, 2019 15:56
-
-
Save isc-rsingh/9a3288729012cd52ac4fec162335ed79 to your computer and use it in GitHub Desktop.
The simplest snippet to read from file in InterSystems Caché
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
From https://community.intersystems.com/post/simplest-snippet-read-file-intersystems-cach%C3%A9