I think the second reply I sent showed it was solved - what do you think
Colin
>The error comes about because narry I forgot that it is a column in a table. The "m." prefix would only work if you had a memory variable with the name. Updated the program:
>
>#DEFINE _CR_ CHR(13)
>#DEFINE _LF_ CHR(10)
>#DEFINE _NL_ _CR_+_LF_
>SELECT eit
>SCAN
> cBuf = CHRTRAN(ALLTRIM(narry),_LF_,_CR_)
> DO WHILE _CR_+_CR_ $ m.cBuf
> narry = STRTRAN(m.cBuf,_CR_+_CR_,_CR_)
> ENDDO
> cBuf = STRTRAN(m.cBuf_CR_,_NL_)
> = strtofile(cBuf, 'c:\colineit.txt', 1)
> = strtofile( _NL_+REPLICATE('-',20)+_NL_,'c:\colineit.txt',1)
>ENDSCAN
>
>to get rid of the extraneous lines with dashes, we could modify thusly:
>
>#DEFINE _CR_ CHR(13)
>#DEFINE _LF_ CHR(10)
>#DEFINE _NL_ _CR_+_LF_
>SELECT eit
>SCAN
> cBuf = CHRTRAN(ALLTRIM(narry),_LF_,_CR_)
> DO WHILE _CR_+_CR_ $ m.cBuf
> narry = STRTRAN(m.cBuf,_CR_+_CR_,_CR_)
> ENDDO
> cBuf = RTRIM(m.cBuf,_CR_," ")
> cBuf = STRTRAN(m.cBuf_CR_,_NL_)
> = strtofile(cBuf+_NL_, 'c:\colineit.txt', 1)
>ENDSCAN
>
>The effect of all those CHRTRAN() and STRTRAN() calls is to basically translate the instances of carriage return and linefeed and turning them into newline sequences of carriage return followed by newline. I'm also reducing repeated newlines into single ones (basically removing "blank" lines). Also at the end when appending string to file, I'm making sure that there is a newline at the end.
Specialist in Advertising, Marketing, especially Direct Marketing
I run courses in Business Management and Marketing