MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » August 2014

Re: writing large single record stream file



fixed

On 8/12/2014 11:10 AM, Jim Franz wrote:
As Charles said, I can write x bytes, clear, read, write x more bytes, even
beyond the 16Mb Jon mentioned.
Can someone point me to sample code that can append to the stream? The
current code I've always used only writes records that end with CRLF
eval @len = %len(%trimr(@textbig))
callp writeline(fd:%addr(@textbig):@len) (and writeline is part of
Scott's download sample code)

It bears repeating that a stream file is nothing but a sequence of
characters. Not fields bound together into records bound together into
a file, but individual bytes strung out one after the other. Your
program can infer meaning from a given collection of bytes, but there's
no such thing as a stream file record.

Having said that, it appears that you're looking to terminate your
stream file with a carriage return. That's what Scott's writeline()
does. If you want to have many iterations before that terminal carriage
return, use write(), in a loop, instead.

dow haveData
read myfile
leave if no rows left
buffer = something
len = %len(%trimr(buffer))
write (fd: %addr(buffer): len)
enddo

buffer = CRLF (or whatever terminator your partner needs)
len = %len(%trimr(buffer))
write (fd: %addr(buffer): len)

--buck





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact