Focal Point
[CLOSED NOT SOLVED] STRREP - Is this expected behaviour?

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

May 29, 2014, 03:23 PM
Francis Mariani
[CLOSED NOT SOLVED] STRREP - Is this expected behaviour?
STRREP (inlength, instring, searchlength, searchstring, replength, repstring, outlength, output)

It seems that if the inlength is less than the searchlength, the output is blank.

See code below. I was expecting the value of VAR2 to be ā€œDā€, just like the value of VAR1. But because the length of the data in VAR1 is less than the length of the string to be replaced, the output is blank.

-SET &ECHO=ALL;

-SET &VAR1 = 'D';

-SET &VAR2 = STRREP (&VAR1.LENGTH, '&VAR1.EVAL', 2, 'ZZ', 4, 'BBBB', 1500, 'A1500');

-TYPE VAR1: &VAR1
-TYPE VAR2: &VAR2

Is this expected behaviour?

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 29, 2014, 05:15 PM
Efrem
I know for the SUBSTR function, when the end length is greater than the inlength, it returns spaces.

end
Integer
Is the ending position of the substring.
If this argument is less than start or greater than length, the function returns spaces.

So, I would think yes.
Just an opinion.
May 29, 2014, 05:39 PM
Waz
The documentation is pretty lite on detail.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 30, 2014, 09:01 AM
Tom Flynn
Hi Francis,
I'm sure you have already thought/done this, but, this is what we do to circumvent:
  
-SET &ECHO=ALL;
-SET &VAR1 = 'D';
-SET &VAR2 = IF &VAR1 CONTAINS 'ZZ' THEN STRREP (&VAR1.LENGTH, '&VAR1.EVAL', 2, 'ZZ', 4, 'BBBB', 1500, 'A1500') ELSE &VAR1;
-TYPE VAR1: &VAR1
-TYPE VAR2: &VAR2
-EXIT



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 02, 2014, 09:05 AM
linnex
Hi guys,

I also found this problem with STRREP about two years ago and reported this to IBI in a case (80732511).
After more than one year the only response on this case was just:

"Thank you for bringing this problem to our attention. We have reviewed it
with our engineering staff and it has been determined that it will not be
implemented in the WebFOCUS product. Therefore, we will close the case.
If this decision substantially impacts your business, please discuss with
your local account support team.
Sincerely,"


And after a complaint of the closure of my case without resolving it:
"The description of behavior at the beginning of the
Using Functions Manual makes it pretty clear that errors
introduced by incorrect parameter handling can produce problems
and that the programmer is responsible for ensuring that the
problems are dealt with."


After that experience with IBI I almost gave up and very rarely raise any Cases with them...

btw. In the docu of searchlength they state "Is the number of characters in the (shorter length) string to be replaced." - probably (shorter length) should be enough for us to know
that the function returns an empty string once the searchstring is longer than the instring.

Cheers Linne


WebFOCUS 7.7.03
June 02, 2014, 10:21 AM
Francis Mariani
quote:
After that experience with IBI I almost gave up and very rarely raise any Cases with them...


Linne, that type of comment from Tech Support would make me open more cases, if only to annoy them...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
June 02, 2014, 05:54 PM
Waz
I also had a bundle of cases closed.

I think they just wanted to clean out the lists of old or less important cases.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!