Question
· Dec 2, 2018

Read command to get a line longer than 32767 symbols

I'm using this code to read a file, line by line.
Most lines are shorter than 32767 symbols, but some are longer. No line is longer than $$$MaxStringLength and long strings are enabled.
Is there a param to Open/Read command I can pass to increase Read limit?
My code:

set filename = pFile
open filename:("R")
for  {
    use filename read x
    quit:$ZEOF=-1
    set ^dbg($i(^dbg)) = $lb($e(x,1,10), $e(x,*-10,*), $l(x))
}
close filename

I've checked reclen parameter but it did not seem to help

 

Discussion (3)0
Log in or sign up to continue

Hi,

I had to prepare a suitable file

Previous case:  Open Param "RU" /UNDEFINED ignores  line terminators

 
USER>open file:("RU":1000000)
 
USER>use file read x use 0 write $l(x)
164405
USER>write $e(x,*-30,*)
e></xs:complexType></xs:schema>

USER&gt;close file

With open Param "RS" /STREAM  line terminators are honored

USER&gt;open file:(<span style="color:#c0392b;"><strong>"RS"</strong></span>:1000000) s l=0
 
USER&gt;use file read x set l=l+$l(x) use 0 write $l(x)," ",l
4126 4126
USER&gt;use file read x set l=l+$l(x) use 0 write $l(x)," ",l
18433 22559
USER&gt;use file read x set l=l+$l(x) use 0 write $l(x)," ",l
61497 84056
USER&gt;use file read x set l=l+$l(x) use 0 write $l(x)," ",l
80343 164399
USER>write $e(x,*-30,*) e></xs:complexType></xs:schema> USER>close file

The difference in lenght results from skipped line terminators.