Focal Point
STRREP / CTRAN not behaving....

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1431048772

March 26, 2008, 02:46 PM
Microfich
STRREP / 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!


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
March 26, 2008, 03:08 PM
smiths
If 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


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
March 26, 2008, 03:28 PM
Microfich
Thanks for your help. My code worked when executing via the servlet but not when in Command Console.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981