Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] replace '^' with '&' in string ..... & causing problem

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] replace '^' with '&' in string ..... & causing problem
 Login/Join
 
Member
posted
Hi All,
I have a string in procedure which i need to replace '^' with '&'. (I used POSIT and STRREP function)
here is the code:

-*this is the string:&URL=Report.aspx?viewby=CG-R-PL^CMGP=10^CMGPDESC=QkNTIFNwZWNpZmlj
-SET &STR1 = &URL;
-SET &STR1A = &STR1;
-SET &STR1LEN = &STR1.LENGTH;
-SET &SP1 = POSIT(&STR1, &STR1LEN, '''', 1, 'I3');
-BLOOP
-SET &STRLEN = &STR1LEN;
-SET &STRSTART = &SP1+1;
-SET &STROUT = 'A' || &STRLEN;
-SET &NSTR = SUBSTR(&STR1LEN, &STR1, &STRSTART, &STRLEN, &STRLEN, '&STROUT');
-SET &STRCNT = IF &SP1 GT 0 THEN &STRCNT + 1 ELSE &STRCNT + 0;
-SET &STR1 = &NSTR;
-SET &SP1 = POSIT(&STR1, &STR1LEN, '''', 1, 'I2');
-IF &SP1 GT 0 THEN GOTO BLOOP;
-SET &STR1ALEN = &STR1LEN + &STRCNT;
-SET &NSTR1 = STRREP (&STR1LEN, &STR1A, 1,'^', 1, '&|', &STR1ALEN, 'A&STR1ALEN.EVAL');
-SET &URL = &NSTR1;



but the output i am getting is
URL = PPVVarianceReport.aspx?viewby=CG-R-PL&CMGP=10&CMGPDESC=QkNTIFNwZWNpZmlj;

how can i remove amp;from output string??

regards
RP

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


webfocus 7.6.9 windows XP Excel
 
Posts: 22 | Registered: July 22, 2009Report This Post
Expert
posted Hide Post
Check out CTRAN
Here's what I got from that:
 BEFORE ... Report.aspx?viewby=CG-R-PL^CMGP=10^CMGPDESC=QkNTIFNwZWNpZmlj
 AFTER .... Report.aspx?viewby=CG-R-PL&CMGP=10&CMGPDESC=QkNTIFNwZWNpZmlj
I hope this helps...




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
replace a 94 with a 38
that's what you need to know for CTRAN function.
94 is the bytval for the ^ and 38 for the &.
ARe you saying you want to now remove the & ??
I don't understand your question.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
Oh Susannah,

I believe that he wanted to change
Report.aspx?viewby=CG-R-PL^CMGP=10^CMGPDESC=QkNTIFNwZWNpZmlj
      to
Report.aspx?viewby=CG-R-PL&CMGP=10&CMGPDESC=QkNTIFNwZWNpZmlj
Change the 94, an up-carrot, to a 38, an ampersand, right? (or, maybe trade in your 22 for a 357?) So anyway, I presented the Good old CTRAN. I believe that should do the trick, don't you? I don't want to do pass on the code, where's the learning factor in that? I just want to pointing RP in the right direction...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Actually, the question from rp that was asked:

quote:

how can i remove amp;from output string??


which, my suggestion would be STRREP:

 
-SET &URL_1  = 'Report.aspx?viewby=CG-R-PL^CMGP=10^CMGPDESC=QkNTIFNwZWNpZmlj';
-SET &URL_11 = STRREP(&URL_1.LENGTH, '&URL_1.EVAL', 1, '^'  ,0,  'X', &URL_1.LENGTH, 'A&URL_1.LENGTH');
-TYPE &URL_11
-EXIT


And, based on the description of the task, where rp's statement is:

quote:

I have a string in procedure which i need to replace '^' with '&'.


I would use, say, STRREP:

  
-SET &URL_2  = 'Report.aspx?viewby=CG-R-PL^CMGP=10^CMGPDESC=QkNTIFNwZWNpZmlj';
-SET &URL_21 = STRREP(&URL_2.LENGTH, '&URL_2.EVAL', 1, '^'  ,1,  '&', &URL_2.LENGTH, 'A&URL_2.LENGTH');
-TYPE &URL_21


But, then again, who knows what the need really is???


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Now, I'm confused. RP's original question is
quote:
I have a string in procedure which i need to replace '^' with '&'.
then RP goes on to say
quote:
how can i remove amp;from output string??
which beckons the question: Why change the "^" to a "&" in the first place?

How about CTRAN and change the 94 to a zero?:
 BEFORE ... Report.aspx?viewby=CG-R-PL^CMGP=10^CMGPDESC=QkNTIFNwZWNpZmlj
 AFTER .... Report.aspx?viewby=CG-R-PLCMGP=10CMGPDESC=QkNTIFNwZWNpZmlj
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Member
posted Hide Post
Hi All first of all Sorry for making the confusion.

Actually in my output string where ever '&' is there its being replaced and shown as & amp ;.(that is why i asked, how can i remove amp;from output string??) .
when i copy pasted the output the post window converted ' & amp ;' into '&' which made the confusion.


webfocus 7.6.9 windows XP Excel
 
Posts: 22 | Registered: July 22, 2009Report This Post
Expert
posted Hide Post
Did you try STRREP? When putting code on this Forum, you wrap them "within" the RED </> code tags, upper-right on the toolbar. Then, click Options on the lower left and check Disable HTML...

-SET &URL_2 = 'Report.aspx?viewby=CG-R-PLamp;CMGP=10amp;CMGPDESC=QkNTIFNwZWNpZmlj';
-SET &URL_21 = STRREP(&URL_2.LENGTH, '&URL_2.EVAL', 4, 'amp;' ,0, 'X', &URL_2.LENGTH, 'A&URL_2.LENGTH');
-TYPE &URL_21


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] replace '^' with '&' in string ..... &amp; causing problem

Copyright © 1996-2020 Information Builders