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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
problem with string
 Login/Join
 
Silver Member
posted
Hi,
I have field in focus type is A50.
In this string are of the special characters or symbols(for example */@ ç ec.)
I must replace this characters with spaces. It 'is possible?
thanks for any help!!!
 
Posts: 31 | Location: roma | Registered: August 18, 2005Report This Post
Master
posted Hide Post
Check out the CTRAN function




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
Short answer - Yes

Look into CTRAN function or GETTOK in conjunction with SUBSTR


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
Roby
slighly longer answer...
example
you want to change all instances of '#' to a blank ' ';
First you need to know what the numeric value is of the '#'
I'll assume you're on a windows server (thus ASCII characters) and not on an IBM Main or midframe (thus EBCIDIC characters)
DEFINE FILE CAR
POUND/I4 WITH CAR=BYTVAL('#','I4');
SPACE/I4 WITH CAR= BYTVAL(' ','I4');
END
TABLE FILE CAR
PRINT POUND SPACE
IF RECORDLIMIT IS 1
END
..and you'll see that the numeric value for the # is 35 and for the SPACE its 32.
then in your own data file,
DEFINE FILE myfile
MYOUTPUT/A80=CTRAN( 80, MYINPUT , 35 , 32, 'A80');
..changes all instances of 32 to 35.
For reference, just because you're in Roma,
@ 64
& 38
- 45
' 39
, 44
" 34
. 46
| 124
/ 47
+ 43
_ 95
[ 60
] 62
( 40
) 41
{ 91
} 93
= 61
$ 36 
* 42
 

.. the opposite of BYTVAL function is the HEXBYT function, takes a numeric value and tells you the character. Download the USING FUNCTIONS manual, if you haven't yet.
and por favour, edit your signature block in your profile on this board to tell us your operating system, your versions, etc.




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
Virtuoso
posted Hide Post
I always found the problem with this was that the code got lengthy, particularly as I prefer STRREP over CTRAN.

A solution I came up with was to use DEFINE FUNCTION, so you can do something like this:
DEFINE FUNCTION cleanStr (string/A50,search/A1) 
 cleanStr/A50 = STRREP(50,string,1,search,1,' ',50,'A50');
END 
DEFINE FILE CAR
OLDSTRING/A50 WITH COUNTRY = 'A string"that?needs@some|characters#replacing';
NEWSTRING/A50 = cleanStr(cleanStr(cleanStr(cleanStr(cleanStr(OLDSTRING,'#'),'|'),'@'),'?'),'"');
END
TABLE FILE CAR
PRINT OLDSTRING NEWSTRING
BY COUNTRY
IF COUNTRY EQ ENGLAND
END  

I am not sure how deep you can nest this, but it seems to be able to go pretty deep.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Great use of FUNCTIONs Alan!! Good One

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders