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     [CLOSED] Invoking a fex from a shell script

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Invoking a fex from a shell script
 Login/Join
 
Member
posted
Is it possible to invoke a fex from a shell script?

My shell script will be a scheduled job which would run periodically, when the shell script would fire, it should trigger the webfocus fex.

Any suggestions? A sample code would be of great help.

Thanks in advance.

This message has been edited. Last edited by: <Kathryn Henning>,
 
Posts: 9 | Registered: January 05, 2012Report This Post
Member
posted Hide Post
Sorry I forgot to mention,
Our webfocus server is hosted on the same UNIX box which would contain the shell script.
 
Posts: 9 | Registered: January 05, 2012Report This Post
Platinum Member
posted Hide Post
Hi, there are various ways to do this.

The WebFOCUS RESTful Web Services option is probably the best way in WebFOCUS 8.0, but it is a module that you will license.
It is also possible to call WebFOCUS procedures via Java.

However, a fairly "simple" mechanism is to call the FOCEXEC using the EDASTART command. EDASTART is located in the WebFOCUS server's bin directory.
I prefer the "edastart -f" option. The "edastart -f" option will allow you to call a t3i file with WebFOCUS "command line" commands (i.e. not Dialogue Manager).

If the bin directory is in your path, you should be able to just type "edastart -?" from unix to see the various options.
If not, you will obviously need to prefix edastart with the full directory name.

So the first thing would be to create a t3i file in the directory from which you will issue the edastart command. It would contain something along the following lines:
%connect                                  
%begin                                    
EX your_focexec_name   
%end                                      
%disconnect                               
%stop_server                                

Assuming we call the t3i file something like "mybatchfex.t3i", then you would invoke it as follows:
edastart -f mybatchfex


Once the process has run, it will create a "mybatchfex.t3o" file which will show you what ran.

The main disadvantage of this method is that the focexec runs in its own "space" and not under the control of the WebFOCUS Server - therefore you cannot monitor it via the HTTP (8121) console.

See if this works for you.


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008Report This Post
Member
posted Hide Post
Thanks Twanette,

I will try this and let you know the outcome.


WebFocus 7.7
Windows,UNIX
Output Formats HTML, Excel,PDF
 
Posts: 9 | Registered: January 05, 2012Report This Post
Master
posted Hide Post
The issue we had with this was running multiple batch jobs at the same time using the edastart -f command. It seemed like they all used the same temp folder. To get around that we enhanced our script to create a temp folder based on the program being run. In our environment, the same batch program is never running more than once at a time, so effectively the temp folder is unique. The script could be modified to add a timestamp to the folder name if a single job needed to be run multiple times at the same time.

This is our .wf_parms file. This sets up environment varible that can be retrived with the FGETENV user written subroutine:

# Set up WebFOCUS paths:
export WFKIDS=/opt/ibi/kids
export KIDSPROD=$WFKIDS/KIDS/prod
export WFAPP=$WFKIDS/ibi/apps
export WFBASEAPP=$WFAPP/baseapp
export WFREPORTS=$WFAPP/reports
export WFTEMP=$WFAPP/temp
export WFMSG=$WFAPP/msgfiles
export WFSCRIPTS=$WFAPP/scripts

# These need to change between Dev, Test and Prod
export WFCLIENT=(your client dns name or ip address)

# Set default folder and file permisions
#   File are rw for owner and group and r for universe
#   Folders are rwx for owner and group and rx for the universe
umask 002



This is the script yifex.sh:

#!/bin/ksh
. /home/ibikids/.profile
umask 000
#
export EDATEMP=$WFAPP/temp/$1
export EDAPROF=.
export EDAPATH=.
#
#  FOCUSFEX holds the program to be run and with the way this is written, the 
#  program must be in the app path
#
export FOCUSFEX=$1
export KIDSHOME=/home/ibikids
#
#  Create temp folder
#
if [ ! -d $EDATEMP ];
  then echo '$EDATEMP does not exist...Creating.'
       mkdir $EDATEMP
       chmod 774 $EDATEMP
  else echo '$EDATEMP exists.'
fi
cd $EDATEMP
pwd
#
#  EDASTART is environment variable point the edastart
#
$EDASTART -f $KIDSHOME/yifex.t3i
#
#  Set environment variable to the current date (YYYYMMDD format) and save execution messages
#
CURRDT=$(/bin/date +%Y%m%d)
mv yifex.t3o $WFMSG/$1.$CURRDT
cd $KIDSHOME
rm $EDATEMP/* 2>/dev/null
rmdir $EDATEMP



This is the yifex.t3i:

%connect
%begin
EX YIFEX
%end
%disconnect
%stop_server



This is the yifex.fex:

-SET &PGM=FGETENV(8,FOCUSFEX,32,'A32');
-SET &PGM=UPCASE(32,&PGM,'A32');
-SET &PGM=TRUNCATE(&PGM);
 EX &PGM
-RUN



Using these pieces, we can run any batch program with this command.
. yifex.sh PROGRAM_NAME


PROGRAM_NAME becomes $1 in yifex.sh

We store the message/screen output in a file named program_name.yyyymmdd where yyyymmdd is the run date. This file is used for debugging if there is a problem. We use another job to automatically delete these message files after 30 days.

Hope this helps.

This message has been edited. Last edited by: jgelona,


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report 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     [CLOSED] Invoking a fex from a shell script

Copyright © 1996-2020 Information Builders