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.
I am trying to extract only the numbers from an alphanumeric field that contains both numbers and letters. The field is a room number (ie. 1305B) and I need to separate out the numbers and letters. I am trying to do this via a define field and split the field into 2 new fields (one number and one letter), but I'm having trouble find a function or a combo of functions that will do the trick.This message has been edited. Last edited by: Kerry,
Thanks Waz. I was both lucky and happy to discover that the EDIT function accepts a field as input for the 'mask' argument. This fact allows the combination of PATTERN and EDIT functions to provide a dandy solution to this type of problem.
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
If your version of FOCUS/WebFOCUS doesn't support function PATTERN, here is an alternative approach using the SUBSTR and CHKFMT functions. The -REPEAT loops are based on the length of the character string being tested (12 in this case), so make appropriate changes for the length of the string you are trying to split.
APP FILEDEF TESTMAS DISK testdata.mas
-RUN
-WRITE TESTMAS FILENAME=TESTDATA,SUFFIX=FIX
-WRITE TESTMAS SEGNAME=TESTDATA,SEGTYPE=S0
-WRITE TESTMAS FIELDNAME=TESTFLD ,ALIAS=TESTFLD ,FORMAT=A12 ,ACTUAL=A12 ,$
-*
APP FILEDEF TESTDATA DISK testdata.ftm
-RUN
-WRITE TESTDATA A 127366250
-WRITE TESTDATA 2B27364433
-WRITE TESTDATA 12C456789
-WRITE TESTDATA 800969INF0
-WRITE TESTDATA 1012D2898
-WRITE TESTDATA 10121E
-WRITE TESTDATA 2 Penn Plaza
-WRITE TESTDATA 917339F380
-WRITE TESTDATA 9173394G50
-WRITE TESTDATA 21273662H0
-WRITE TESTDATA 212736443I
-WRITE TESTDATA 2127366250
-WRITE TESTDATA 10121 J
-RUN
-*
DEFINE FILE TESTDATA
-REPEAT ENDREPEAT1 FOR &I FROM 1 TO 12
TESTCHAR/A1 = SUBSTR(12,TESTFLD,&I,&I,1,'A1');
CHECKFMT/I1 = CHKFMT(1,TESTCHAR,'9','I1');
NUMBERS&I/A1 = IF (CHECKFMT EQ 0) THEN TESTCHAR ELSE '';
LETTERS&I/A1 = IF (CHECKFMT NE 0) THEN TESTCHAR ELSE '';
-ENDREPEAT1
-*
NUMBERS/A12 = NUMBERS1
-REPEAT ENDREPEAT2 FOR &I FROM 2 TO 12
|| NUMBERS&I
-ENDREPEAT2
;
-*
LETTERS/A12 = LETTERS1
-REPEAT ENDREPEAT3 FOR &I FROM 2 TO 12
|| LETTERS&I
-ENDREPEAT3
;
END
-*
TABLE FILE TESTDATA
PRINT TESTFLD NUMBERS LETTERS
END
This message has been edited. Last edited by: Dan Satchell,
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007