March 26, 2008, 02:46 PM
MicrofichSTRREP / CTRAN not behaving....
Hi,
I am trying to replace all commas with a comma and carriage return/line feed in a long string but results are inconsistent.
DEFINE FILE TEMPFILE
CRLF/A2 = HEXBYT(13,'A1') | HEXBYT(10,'A1');
XLROLE/A1116 = STRREP(1116, BASEFIELD, 1, ',' , 3, ','|CRLF, 1116, 'A1116');
END
What's happening is unpredictable. Sometimes the comma is being replaced by a comma|line feed as expected. Sometimes the comma doesn't get replaced but a line feed occurs after the next blank character after the comma. There is no 'space' after or before all the commas in the base field (BASEFIELD). Is there confusion due to replacing the comma with another comma (and line feed)? I also tried CTRAN with the same results. Output is to EXL2K. SQUEEZE is ON.
Thanks, if you can help!
March 26, 2008, 03:08 PM
smithsIf you have a string in BASEFIELD that is 1116 characters long and contains one comma for example, then your replacement string would have 1118 characters, which is longer than XLROLE is declared.
So it might have something to do with the size of your target field not being allocated large enough.
Sean
March 26, 2008, 03:28 PM
MicrofichThanks for your help. My code worked when executing via the servlet but not when in Command Console.