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.
You don't tell us what happens when you attempt to use the function, but I suspect you need a -RUN after the function definition and before you try to use it.
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Sorry! That was a bad cut and paste job on my part I have a -RUN after the define but the &TEST1 variable always returns 0. I have updated the original post but the entire source is :
-SET &STUFF='All';
DEFINE FUNCTION ISVALIDENTRY(FLD/A20, ENTRIES/A20)
STRIPPED/A20=STRIP(20, FLD, ',', '');
ISVALIDENTRY/I2=ENTRIES CONTAINS STRIPPED;
END
-RUN
-SET &TEST1=ISVALIDENTRY('&STUFF.EVAL','All,E,I,O');
-TYPE &TEST1;
if you run with echo all, you'll see that the function name must be 8 letters long, no more. (in 7.6.8 ,anyway) -SET &STUFF='All'; DEFINE FUNCTION ISVALIDENTRY(FLD/A20, ENTRIES/A20) STRIPPED/A20=STRIP(20, FLD, ',', ''); ISVALIDENTRY/I2=ENTRIES CONTAINS STRIPPED; END -RUN (FOC1940) DEFINE FUNCTION name not 1-8 characters: ISVALIDENTRY BYPASSING TO END OF COMMAND -------- another thing to be aware of is that you're specifying 3 characters in an &var, but when you pull it into the function, you're taking 20 characters, the initial 3 plus whatever 17 are next to it in memory. might be playing a part here. so your test should be carried out on defines, rather than on dm machinations w/ &vars.This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
Yes - the actual vs assigned length of the test value is causing the issue.. here is one way of getting around it..
-SET &STUFF='All';
-SET &LEN = IF &STUFF.LENGTH LT 10 THEN EDIT(&STUFF.LENGTH,'$9') ELSE &STUFF.LENGTH;
DEFINE FUNCTION ISVALIDENTRY(FLD/A&LEN.EVAL, ENTRIES/A20)
STRIPPED /A&LEN.EVAL=STRIP(&LEN.EVAL,FLD,',',STRIPPED);
ISVALIDENTRY/I1= ENTRIES CONTAINS STRIPPED;
END
-RUN
-SET &TEST1=ISVALIDENTRY('&STUFF.EVAL','All,E,I,O');
-TYPE &TEST1;
-EXIT
This code doesn't take care of the length cals for values that contain commas --it would be better to do the STRIPping of commas in DM before passing it to the function.
thanks SashankaThis message has been edited. Last edited by: Severus.snape,
WF 7.7.03/Windows/HTML,PDF,EXL POC/local Dev Studio 7.7.03 & 7.6.11
-SET &STUFF = 'JAG,,,';
DEFINE FILE IBISAMP/CAR
STUFF/A6 WITH CAR = &STUFF.QUOTEDSTRING ;
STRIPPED/A20 WITH CAR =STRIP(20,STUFF , ',' , '');
ISVALID/I2 = CAR CONTAINS STUFF ;
END
TABLE FILE IBISAMP/CAR
PRINT CAR STUFF STRIPPED ISVALID
END
and you'll see what's happening with the size mismatch...
You're confusing STRIP with STRREP the syntax for STRIP that you have is STRIPPED/A20=STRIP(20, FLD, ',', '');
the syntax should be STRIPPED/A20=STRIP(20, FLD, ',', STRIPPED);This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003
But there seems to be a flaw in my logic. The function will also return 1 when I set &STUFF='Al'. Is there any other ways to make sure that a specific value is in a list of values?
What I ended up doing is writing a python script that can be called with my parameter and the list of valid values and sets the exit code. Webfocus checks the exit code via the &EXITRC variable.
Something similar can probably be in a shell script.