read instruction stores only every second value
Posted: Mon Jan 28, 2019 8:49 am
Dear Tom,
I could get stock data in a json file. To start with the most simple file, I did download only the data for one day. My idea was to write a RATS program file to read the whole file into a vector of strings. Once all strings are red, I could loop through the vector searching for those containing the pride fields for the open, high, low, close, volume and adjusted close. I just modified the example for the read instruction slightly as the strings in the file are seperated by comma, but do not include characters for carriage return and/or line feed. For test purpose, I used the following code.
The problem is that this code only reads every second string. The number of rows is about half of the number of strings separated by comma. What do I wrong?
I have attached the json file and a text file showing the strings, which should be read by the code.
Best regards
PeterF
I could get stock data in a json file. To start with the most simple file, I did download only the data for one day. My idea was to write a RATS program file to read the whole file into a vector of strings. Once all strings are red, I could loop through the vector searching for those containing the pride fields for the open, high, low, close, volume and adjusted close. I just modified the example for the read instruction slightly as the strings in the file are seperated by comma, but do not include characters for carriage return and/or line feed. For test purpose, I used the following code.
Code: Select all
declare vector[string] response
open Data "C:\Users\User\Downloads\DBK.json"
read(format=cdf,varying) response
do i=1, %rows(response)
disp response(i)
end do
disp %rows(response)
I have attached the json file and a text file showing the strings, which should be read by the code.
Best regards
PeterF