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

 

  • 0
  • 0
  • 52
  • 1
  • 2

Answers

Hi,

I just tried this  :

USER>set file="Eduard.txt"
 
  USER>open file:("RU":1000000)
 
  USER>use file read x#1000000
 
  USER>write $length(x)
  183237
  
  USER>

"RU":Reclen    seams to do the trick 

I used it in READ just as fallback. The content was as expect.

It reads up to 1000000 characters, not stopping on line terminator.

I want x variable to contain only one line from file.

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.