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] Keep certain characters in string and removing all special/other characters

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Keep certain characters in string and removing all special/other characters
 Login/Join
 
Silver Member
posted
Hi,


I was wondering if anyone has other methods of keeping certain characters in a alphanumeric field and dumping all other characters. I came up with a function, which is used when a TABLE FILE is issued. I also don't know what all the special characters could be. The performance is decent since I'm applying it only to a limited number of records but still looking for alternatives.

DEFINE FUNCTION F_REMOVE_SPECIALCHAR (IN_STRING/A300)
 
TMP_STRING/A300=IN_STRING;
 
-SET &SMSF_FRSC_I = 0;
-REPEAT CHK_ALL_CHAR 240 TIMES
-SET &SMSF_FRSC_I = &SMSF_FRSC_I + 1;

-* Ascii codes of all the characters to keep:
-* space(32), #(35), -(45), 0-9, a-z, A-Z
-IF ( (&SMSF_FRSC_I EQ 32) OR (&SMSF_FRSC_I EQ 35) OR (&SMSF_FRSC_I EQ 45) OR ((&SMSF_FRSC_I GE 48) AND (&SMSF_FRSC_I LE 57)) OR ((&SMSF_FRSC_I GE 65) AND (&SMSF_FRSC_I LE 90)) OR ((&SMSF_FRSC_I GE 97) AND (&SMSF_FRSC_I LE 122)) ) THEN GOTO SMSF_FRSC_END_CHK_ALL_CHAR;

-* Convert unwanted characters to space 
TMP_STRING/A300 = CTRAN(300, TMP_STRING, &SMSF_FRSC_I, 32, 'A300');
 
-SMSF_FRSC_END_CHK_ALL_CHAR

-* Removing extra spaces 
STRING_RM_SPACE/A300=SQUEEZ(300,TMP_STRING,'A300');

F_REMOVE_SPECIALCHAR/A310 = STRING_RM_SPACE;
END
-RUN



Looking forward to suggestions ... thanks!
JL

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


Year(s) of experience in WebFOCUS: 5+. Using WebFOCUS 7.7.03 on Windows platform with Oracle/SQL Server.
 
Posts: 41 | Registered: September 08, 2008Report This Post
<HarryL>
posted
Starting with WebFOCUS 7.1.0, string replacements (more than 1 character) can
be done using the STRREP function. The following illustrates an example on how
to convert CRLF characters to spaces:

IDX/A2000 = ID;
CRLF/A2 = HEXBYT(13,'A1') | HEXBYT(10,'A1');
DD/A2 = ' ';
IDESCA/A2000 = STRREP(2000,IDX,2,CRLF,2,DD,2000,'A2000');
 
Report This Post
Virtuoso
posted Hide Post
Build a FUSE routine. See the stored procedure reference manual for doc.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report 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] Keep certain characters in string and removing all special/other characters

Copyright © 1996-2020 Information Builders