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 looking for an example of invoking a Unix Shell Script from WebFOCUS Fex Code. I used following. It works successfully but does not return 33. It returns 0. Is this expected ? If so, how to get the actual return code of 33 ?
I tried SYSTEM, !, UNIX and SPAWN. The SPAWN silently returned zero no matter what the shell command/script was provided as an argument. I used the SPAWN with DEFINE and COMPUTE as stated in the manual and tried to generated a fake report with a TABLE FILE. No luck. It returned zero.
The SYSTEM, !, UNIX successfully ran the script (I can see the side effects by writing to some file) but with always zero return code. I tried getting the return code by assignment, by &RETCODE and by using -TYPE. I tried by putting return and exit statements in the script. I tried the return type as D2, D4 and D8. No luck.This message has been edited. Last edited by: Govind Jujare,
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
A couple of ways to achieve this, both a little long-winded: 1. Have your shell script write the return code to a file and have WebFocus -READ the result from the file. If you first test for the existence of the file, using STATE, and don't find it, you also know you have an error. 2. Have your shell script set and export an environment variable, then use the WebFocus FGETENV() subroutine to read that variable.
Posts: 15 | Location: New York | Registered: April 02, 2004
But RC3 came back as 'FOCUS' in the fex code. I guess this is to be expected. Because in Unix the values of shell variables are not copied back from child process to the parent process (unless you explicitely send them through a file or pipe or socket .. etc).
I didn't try writing to files because of efficiency concerns ... I guess I will have it give it another thought.
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
I been struggling to recollect information about the 'STATE' that you talked about (to check existence of a file). I am not able to find it in manuals. Actually that can help me to certain extent.
Thx,
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
This shows both methods working, and also the usage of STATE:
-* ttest.fex: FILEDEF SRCFILE DISK out.txt (RECFM V LRECL 80 -DEFAULT &RC3='ABCDEFGH' -DEFAULT &RC4='ABCDEFGH' -RUN !. ./scr.ksh -RUN
-SET &RC3 = FGETENV(4,'VAR1',20,'A20'); -RUN STATE ./out.txt -RUN -IF &RETCODE EQ 0 GOTO HAVDAT ; -TYPE File out.txt not found in current directory. -GOTO ENDIT
Robin, I got follg output. Is RC3 supposed to show up as 'MODIFY' ? I used an absolute path for scr.ksh (because I am in MRE).
IORET= 0
RC3=
RC4=MODIFY
To double check, I introduced a FPUTENV for VAR1 at the top of the fex and saw RC3 getting the value unchanged. I wonder what I am doing wrong. Thx for the tip on 'STATE'.
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
Even though I was not able to make get the return code of the shell script OR get the env variable from shell script using 'FGETENV' .... the 'STATE' command worked proved sufficient in my case. OTOH, I see that all the output of the script is getting pumped into the generated HTML file in the form of comments. That helps me in figuring out what went wrong with the shell script. That ought to be enough in my case.
Thx,
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
If it has really worked for somebody, may be it is because of something in their environment. May be sh/ksh. May be MRE/self-serv. Anyway, thx for the "STATE" trick.
WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic