Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     (Solved) - limitations of STRREP
Go
New
Search
Notify
Tools
Reply
  
(Solved) - limitations of STRREP
 Login/Join
 
Member
posted
I am using dialogue manager to replace a "^" character with a "&" character, but the variable that is being used is over 5000 characters in length and it's failing:

-SET &parm_list = STRREP(&REPORTPARAMETERS.LENGTH,&REPORTPARAMETERS,1,'&',1,'^',&REPORTPARAMETERS.LENGTH,'A&REPORTPARAMETERS.LENGTH');

This will work up to 4000 characters, but fails if the &REPORTPARAMETERS value is any longer.

We are using both WF version 8005 and 8105, but it seems to fail on either version.

any ideas?

This message has been edited. Last edited by: Troy_proffitt,


WF version 8105
all output
 
Posts: 22 | Registered: February 17, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Would REPLACE work in this case?

https://webfocusinfocenter.inf...r/source/replace.htm


WebFOCUS 8206, Unix, Windows
 
Posts: 1658 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Member
posted Hide Post
I just tested in both 8009 and 8105 and that function isn't available.


WF version 8105
all output
 
Posts: 22 | Registered: February 17, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
May be a pain, but what if you split your variable into two (or more) of 4000 char (or less) each, then perform the STRREP to each and merge them back into one var ?
-SET &MAXLEN  = 25;
-SET &POS2    = &MAXLEN + 1;
-SET &LONGSTR = 'ABCDEFG^HIJKLMN^OPQRSTU^VWXYZ12^3456789^0';

-SET &LEN_STR = &LONGSTR.LENGTH;
-IF &LEN_STR GT &MAXLEN THEN GOTO SPLITSTR;

-SET &TSTR    = TRIMV('T', &LONGSTR, &LONGSTR.LENGTH, ' ', 1, 'A&LONGSTR.LENGTH');
-SET &LONGSTR = STRREP(&TSTR.LENGTH, &TSTR, 1, '^', 1, '&', &TSTR.LENGTH, 'A&TSTR.LENGTH');
-GOTO ENDREPLSTR

-SPLITSTR
-SET &SPLIT1  = SUBSTR(&LONGSTR.LENGTH, &LONGSTR,  1, &MAXLEN, &MAXLEN, 'A&MAXLEN.EVAL');
-TYPE SPLIT1: &SPLIT1<--
-SET &NSPLIT1 = STRREP(&SPLIT1.LENGTH, &SPLIT1, 1, '^', 1, '&', &SPLIT1.LENGTH, 'A&MAXLEN.EVAL');
-TYPE NSPLIT1: &NSPLIT1<--

-SET &SPLIT2  = SUBSTR(&LONGSTR.LENGTH, &LONGSTR, &POS2, &LONGSTR.LENGTH, &MAXLEN, 'A&MAXLEN.EVAL');
-TYPE SPLIT2: &SPLIT2<--
-SET &TSPLIT2 = TRIMV('T', &SPLIT2, &SPLIT2.LENGTH, ' ', 1, 'A&SPLIT2.LENGTH');
-SET &NSPLIT2 = STRREP(&TSPLIT2.LENGTH, &TSPLIT2, 1, '^', 1, '&', &TSPLIT2.LENGTH, 'A&TSPLIT2.LENGTH');
-TYPE NSPLIT2: &NSPLIT2<--

-SET &LONGSTR = &NSPLIT1 || &NSPLIT2;

-ENDREPLSTR
-TYPE NEW LONGSTR: &LONGSTR<--


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
I assume, you'd have to change :
-SET &SPLIT1 = SUBSTR(&LONGSTR.LENGTH, &LONGSTR, 1, 4000, 4000, 'A4000');
-SET &SPLIT2 = SUBSTR(&LONGSTR.LENGTH, &LONGSTR, 4001, &LONGSTR.LENGTH, 4000, 'A4000');

correct?


WF version 8105
all output
 
Posts: 22 | Registered: February 17, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
Have you considered CTRAN?
The CTRAN function translates a character within a character string to another character based on its decimal value. This function is especially 
useful for changing replacement characters to unavailable characters, or to characters that are difficult to input or unavailable on your keyboard. It can also be used for inputting 
characters that are difficult to enter when responding to a Dialogue Manager -PROMPT command, such as a comma or apostrophe. It eliminates the need to enclose entries in single 
quotation marks (').

To use CTRAN, you must know the decimal equivalent of the characters in internal machine representation. Note that the coding chart for conversion is platform dependent, hence your 
platform and configuration option determines whether ASCII, EBCDIC, or Unicode coding is used. Printable EBCDIC or ASCII characters and their decimal equivalents are listed in 
Character Chart for ASCII and EBCDIC.

In Unicode configurations, this function uses values in the range:

 ♦ 0 to 255 for 1-byte characters.
 ♦ 256 to 65535 for 2-byte characters.
 ♦ 65,536 to 16,777,215 for 3-byte characters.
 ♦ 16,777,216 to 4,294,967,295 for 4-byte characters (primarily for EBCDIC).
 
Posts: 2976 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Troy_proffitt:
I assume, you'd have to change :
-SET &SPLIT1 = SUBSTR(&LONGSTR.LENGTH, &LONGSTR, 1, 4000, 4000, 'A4000');
-SET &SPLIT2 = SUBSTR(&LONGSTR.LENGTH, &LONGSTR, 4001, &LONGSTR.LENGTH, 4000, 'A4000');

correct?

Yes, but the way I wrote the code I made it more flexible using parameters &MAXLEN, &POS2.
So, you don't need to change numbers at several places
I also insure that the string have no spaces at the end. What you are doing when you are keeping all the variables with a fix length of 4000


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
Here's the result from using CTRAN:
*** parm_list In : I need to replace all "^" character with a "&" character, in a 5000+ character variable. "^" ***
*** parm_list Out: I need to replace all "&" character with a "&" character, in a 5000+ character variable. "&" ***
 
Posts: 2976 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Guru
posted Hide Post
quote:
Have you considered CTRAN?


To echo Doug, I was able to use that function on a parameter that is 25,600 in length:
  
-SET &PARAMETER = 'Lorem^ipsum^dolor^sit^ut^amet^consectetur^adipiscing^elit^sed^do^eiusmod^tempor^incididunt^ut^labore';

-REPEAT LABEL 8 TIMES
-SET &PARAMETER = '&PARAMETER.EVAL&PARAMETER.EVAL';
-LABEL 

-TYPE ***BEFORE***
-TYPE PARAMETER: &PARAMETER;
-TYPE LENGTH: &PARAMETER.LENGTH;

-SET &LEN = &PARAMETER.LENGTH;
-SET &PARAMETER = CTRAN(&LEN, &PARAMETER.QUOTEDSTRING, 94, 38, 'A&LEN.EVAL');

-TYPE ***AFTER***
-TYPE PARAMETER: &PARAMETER;
-TYPE LENGTH: &PARAMETER.LENGTH;


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 431 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Guru
posted Hide Post
I found this site to get the ASCII decimal numbers from: https://ascii.cl/


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 431 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Guru
posted Hide Post
If this has corrected the issue that you were facing, please change the post title to include [Solved].


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 431 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Member
posted Hide Post
I tried out the CTRAN code and it works perfectly! Thanks for the help.


WF version 8105
all output
 
Posts: 22 | Registered: February 17, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     (Solved) - limitations of STRREP

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.