|
Hi Griz, [SNIP]
StringVal = 'LINE 1 '; StringValW = %TrimR(StringVal) + CRLF; Fd=write(RC2:%addr(stringvalW):%Len(%Trim(stringvalW)));
[SNIP]
The output in the IFS file reads as follows: LINE1 LINE2
Is StringValW 2 characters longer than StringVal? If not, you could run out of space for the CRLF in the StringValW field, which would cause the problem you're experiencing. In other words, if StringVal is 100A, StringValW needs to be 102A.
Would I be better off using O_TEXTDATA in place of O_CODEPAGE if I was dealing with a text file/HTML file?
O_CODEPAGE and O_TEXTDATA aren't alternatives to one another.O_CODEPAGE tells the operating system the codepage of the data you intend to write to the IFS. In this case, you've told it that the code page is 819 (which is ISO 8859-1 ASCII)... which means that if you're doing it right (and I don't think you are) the data from your program would have to be in that codepage.
O_TEXTDATA means that you want the operating system to translate from your job's codepage to the file's codepage when you write, or from the file's codepage to the job's codepage when you read. O_TEXTDATA is only meaningful if it's used on a file that already exists, or if you also specify O_TEXT_CREAT. If you're creating the file on the same open() statement, and haven't specified O_TEXT_CREAT, then it won't have any effect.
Usually on pre-V5R2 systems, you'll open the file once to create it and assign a codepage. Then close it. Then open it again, this time with O_TEXTDATA so that the system will automatically translate it.
however, the codepage/textdata issue has nothing whatsoever to do with your text appearing on the same line as the previous text. Lines of text end when the line delimiter (in this case, CRLF) is found. The only reason it would fail to advance to the next line is if the delimiter isn't found for some reason. Somehow you're failing to get that CRLF into the data.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.