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     Removing Embedded spaces

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Removing Embedded spaces
 Login/Join
 
Member
posted
I have an alphanumeric field that has spaces between significant digits that can occur any place within that field (ie. no set postion in the field). Is there a way to remove the embedded spaces, basically smashing everything together? I figured out how to remove them before or after significant digits, but not when they are in the middle.

Hopefully someone can help. Thanks
 
Posts: 13 | Registered: June 01, 2005Report This Post
Guru
posted Hide Post
In the Technical Documenation Library above, search for STRIP.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Platinum Member
posted Hide Post
Here's one method using SUBSTR. Loop through your string a character at a time, and build a new string based on the non-blank characters.

-* Set initial value to be parsed
-SET &FIELD = ' 12 3 xxx 456 7 8 9 ';

-* Get the length of the field
-SET &FIELD_LEN = &FIELD.LENGTH;

-* Set the field format
-SET &FIELD_FMT = 'A' | &FIELD_LEN;

-* Initialize the field that will store the parsed field
-SET &NEWSTR = '';

-* Initialize the loop index
-SET &IDX = 1;

-* Iterate through the number (&FIELD)
-REPEAT :ENDLOOP WHILE &IDX LE &FIELD_LEN;

-* Get the next character in the string
-SET &CHARACTER = SUBSTR(&FIELD_LEN, &FIELD, &IDX,
- &IDX, 1, 'A1');

-* If a non-blank is found, append it to the new
-* string, otherwise do nothing
-SET &NEWSTR = IF (&CHARACTER NE ' ') THEN &NEWSTR || &CHARACTER
-ELSE &NEWSTR;

-* Advance to the next character
-SET &IDX = &IDX + 1;

-:ENDLOOP

-* Remove trailing space
-SET &NEWSTR = TRUNCATE(&NEWSTR);

-* Here's the final value
-TYPE NEWSTR: (&NEWSTR)


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Expert
posted Hide Post
and SQUEEZ function will smash multiple blanks to a single blank, might be a good way to start.




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
Platinum Member
posted Hide Post
As jimster06 said, I think STRIP function is the right option.

TABLE FILE CAR
  PRINT
    COMPUTE TEST1/A15   = ' 1 2 3 5. 6   5' ;
    COMPUTE TEST2/A15   = STRIP(15, TEST1, ' ', TEST2);
    COMPUTE TEST3/D15.2 = ATODBL(TEST2, '15', TEST3); 
    COUNTRY
  IF READLIMIT EQ 1
END
-RUN


Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
Member
posted Hide Post
Everyone,

Thanks for your help. I have it working great with a the Strip function. I really need to get some updated manuals!! Roll Eyes
 
Posts: 13 | Registered: June 01, 2005Report 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     Removing Embedded spaces

Copyright © 1996-2020 Information Builders