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     Passing error code generated in FOCUS to UNIX shell script

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Passing error code generated in FOCUS to UNIX shell script
 Login/Join
 
Member
posted
Hello,

How can I pass error code generated in FOCUS (&FOCERRNUM or &RETCODE ) error code as to UNIX Shellscript? Basically I want to trap FOCUS errors while executing focus programs from UNIX shellscript.

Here is code in my shellscript. I have created error condition in my FOCUS program so that it will throw error but I am not able to catch that error in shellscript?

Also how do we pass error code to Windows BatchFile?


Thanks


#-----------Shell Script----------------
cd /eda/ibi/focexecs/prodcomm

/eda/ibi/srv52/wfspv2100/bin/edastart -f carrpt >> $LOGFILE

echo $RETCODE
echo $FOCERRNUM

if $? -ne 0 ; then
echo "$0 failed executing edastart-carrpt" >> $LOGFILE
exit 8;
fi

if $? -eq 0 ; then
echo "$0 Successful executing edastart-carrpt" >> $LOGFILE
exit 8;
fi
 
Posts: 19 | Location: Allstate Insurance Co. | Registered: January 25, 2005Report This Post
Gold member
posted Hide Post
We have a perl script that checks both the $? and scans the log file for FOCUS errors. This works for us. Welcome to purgatory. :-)
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report This Post
Member
posted Hide Post
jbmuir

Thanks for the warm welcome!
Razzer

Does your perl script returns you value in $?
Also when you are scanning log which I belive you mean is edaprint.log, How do you make sure that error is not from other program and everything is kosher?


THanks
 
Posts: 19 | Location: Allstate Insurance Co. | Registered: January 25, 2005Report This Post
Gold member
posted Hide Post
The edaprint log is worthless, and edastart does not return a useful return code (as you've discovered). Here's a simple example that includes a test fex that has an error in it, and a perl script that runs edastart and captures the error.

TABLE FILE CAR
PRINT
COUNTRSYDSD
END
-RUN

#!/usr/bin/perl -w
use strict;
use English;

my $logfile = 'test.log';

my $rc = system(qq(/path/to/edastart -x "ex test" > $logfile));

my $focerr = scanlog($logfile);

print "rc: $rc focerr: $focerr\n";

sub scanlog
{
my $logfile = shift(@_);

my $focerr = 0;

open IN, "X$logfile" or die "Could not open $logfile: $ERRNO\n";

while (my $line = <IN>Wink
{
chomp $line;

next if (!($line =~ m/\(foc(\d+)\)/io)); # Got a (FOCnnnn) error?

$focerr = $1;

last;
}

close IN;

return $focerr;
}

BTW, You'll have to change the 'X' in "X$logfile" to a "less than" character due to this persnickety bulletin board software. Grrrrrrr. Mad
HTH, -James
 
Posts: 83 | Location: Dartmouth Hitchcock Medical Center | Registered: April 17, 2003Report 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     Passing error code generated in FOCUS to UNIX shell script

Copyright © 1996-2020 Information Builders