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.
Here's an example of how to count a character in a string.
1) Determine the length of the string 2) Convert the 1's to blanks 3) Strip the blanks out of the string 4) Determine the length of the string without the blanks 5) Determine the number of blanks in the string by subtracting the length of the string without the blanks from the length of the string
DEFINE FILE CAR
NUMSTRING/A15 =
IF COUNTRY EQ 'ENGLAND' THEN '011100101110101' ELSE
IF COUNTRY EQ 'FRANCE' THEN '110100111111000' ELSE
IF COUNTRY EQ 'JAPAN' THEN '011001100010001' ELSE
IF COUNTRY EQ 'ITALY' THEN '101010101010010' ELSE
'010101101010001';
INSTRLEN/D4 = ARGLEN(15, NUMSTRING, 'D4');
OUTSTR1/A15 = CTRAN(15, NUMSTRING, BYTVAL('1','I3'), BYTVAL(' ','I3'), OUTSTR1);
OUTSTR2/A15 = STRIP(15, OUTSTR1, ' ', OUTSTR2);
OUTSTRLEN/D4 = ARGLEN(15, OUTSTR2, 'D4');
NBR_ONES/D4 = INSTRLEN - OUTSTRLEN;
END
TABLE FILE CAR
PRINT
NUMSTRING
-*INSTRLEN
-*OUTSTR1
-*OUTSTR2
-*OUTSTRLEN
NBR_ONES
END
all methods above are good. my preference is Frank's. But just to throw another flavor at ya..(Yes -repeat here would be better, but I elongated to hsow you logic behind it.) -REPEAT (looping). -* INITIALIZE SOME DUMMY VALUE.. -SET &CHK1 =4; -SET &CHK2 =5; -SET &CHK3 =6; -SET &CHK4 =7; -SET &CHK5 =8; -* INITIALIZE A HOLDING BUCKET FOR THE VALUE... -SET &KNTR = 0 ; -RUN DEFINE FILE CAR TST/A31 WITH COUNTRY='1010101010101010101010101010101'; END TABLE FILE CAR PRINT TST WHERE RECORDLIMIT EQ 1 ON TABLE SAVE AS MYDUMMY END -RUN -READ MYDUMMY NOCLOSE &CHK1 &CHK2 &CHK3 &CHK4 &CHK5 (....to 31) -SET &KNTR = &KNTR + &CHK1 + &CHK2 + &CHK3 +&CHK4 + &CHK5; (all the way to 31).. -TYPE &KNTR ; -READ MYDUMMY NOCLOSE -EXIT