FoxAPI programming problems on AW70

2000-03-21 Thread Cyrus W. Taft

Message text written by Foxboro DCS Mail List
has anyone succeeded in adding objects with read/write access to an
application's CDX on the AW70 using the FoxAPI function an_add_objects()? 
Adding read only objects works fine, but read/write access fails although
FoxDoc describes it and even gives an example program (which fails, too). 
So I'm wondering who is wrong, the function's documentation or the example
program.
 
I have a small test program here which tries to add two RI parameters of a
CALC block to the CDX.  I could send it to anyone interested.  We've tried
this program on virtually every FoxAPI version we could find and it always
failed with return code 76 which is not mentioned by FoxDoc as a possible
return code for an_add_objects().  foxapi.h defines it but the description
there doesn't tell much since I don't pass any NULL pointers.  If you
change 'rdwrit' to 'rdonly' (for access type) in the program, it works
fine.

I could of course open a data set instead for writing but I'm reluctant
because doing so gives me those annoying command prompt windows flickering
up briefly upon set opening and closing.  Data sets also stay open if
someone kills the application with the task manager.


Sascha,
This won't exactly address your question but we have also noticed a change
in the behavior of the foxapi on Solaris when writing to block parameters. 
On version 4.0.1, we had a C program which wrote values to the INP2
parameter of 2 SWCH blocks and it worked fine.  We upgraded to version 6.1
for Y2K and now the same program won't work.  Both versions used a set for
the 2 INP2 parameter points and I think there is a problem creating the
sets for write access. We use the sxopen utility to create the sets.  We
have another application which writes data into shared variables in a set
and it still works.  So I created two new shared variables, put them in a
set and linked them to the INP2 parameters and used the C program to write
to the shared variables.  It now works fine but I don't know why it would
not work the old way.  It seems that something has changed in the API.

Cyrus Taft
EPRI IC Center

---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to [EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




Re: FoxAPI programming problems on AW70

2000-03-21 Thread Sascha Wildner

Cyrus,

thanks for your answer.  That's interesting.  What exactly didn't work when
you made the transition to 6.1?
Did writing to the SWCH block parameters always fail or just sometimes?
What function call did you use for writing?

It's really weird.  I have noticed myself that writing doesn't always work.
I have a program which writes the IN_1-5 parameters of BLNALM blocks in such
a way that always one of those inputs is set and the others are 0.  If I
test it here on my local AW70 in the internal station, it works fine.  If I
go to the customer, it shows very strange behavior.  Sometimes more than one
input is 1 as if the setting to 0 didn't work correctly.

But the shared variable hint might be a solution.  Thanks so far.

Regards,
Sascha Wildner



---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




Re: Jetadmin Software

2000-03-21 Thread Sascha Wildner

Cyrus,

regarding text file printing, I always converted the text file to postscript
before printing and then it always worked fine.

Try

/usr/lib/lp/postscript/postprint file | lp -dprinter

That should do the trick.  For more information (setting page orientation,
point size, etc.), try man postprint.

The background is that the printers behave the DOS way by default which
requires CR/NL at the end of lines.  There is also some other way to fix it
by directly putting some escape sequence into the script through which all
output to the printer is filtered but I don't remember exactly.  I could
find that out if you want.

I don't know if JetAdmin fixes these problems, but I doubt it.

Regards,
Sascha Wildner



---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




RE: FoxAPI programming problems on AW70

2000-03-21 Thread Johnson,Alex

Writing to Boolean parameters is not as obvious as one might think. It might
be worth reviewing your code after reading this. I've seen many occasions
were a simple misunderstanding resulted in strange data being written to
Boolean parameters. 

Depending on how you write your code and how data is intialized, you can get
very strange results. Hope this helps.

Also, be sure to duplicate your FoxAPI programming problems using
/opt/fox/ais/bin/foxtst (or /opt/fox/ais/bin/aistst for older systems). This
tool will let you try each call indivdually to see if you understand its
operation properly. It can also be scripted using the  redirection
operation of the Bourne shell.


Regards,

Alex Johnson
The Foxboro Company
10707 Haddington
Houston, TX 77043
713.722.2859 (v)
713.722.2700 (sb)
713.932.0222 (f)
[EMAIL PROTECTED]


The Value Record for all OM variables is arranged as follows per
/usr/include/fox/om_udat.h (with minor edits for clarity)

union var_val{
   char letter;
   int  word;
   unsigned int uword;
   unsigned longulong;
   long longint;
   floatfpoint;
   struct str_rec   str_val;
};

struct value_rec {
   unsigned int status;
   union var_valuval;
};

As you can see, the boolean value (the element letter in the union var_val)
is the right most bit of the left most byte of the union.

Therefore,  0x1000 represents true and 0x represents false.


Here's a code excerpt from an OM program that does work.

unsigned int status  = BOOLEAN;
unsigned char value;
unsigned int length  = sizeof(char);
char name[33];

if ( use_block )
{
   value = (almState == INTO_ALARM);
   sprintf(name, %s:%s.IN, cName, bName);
   ec = setval(name, VARIABLE, 0, (char *)value, status, length);
   /*
   if (ec)
  fprintf(stderr, name=%s status=%04x ec=%d\n, name, status, ec);
   */
}

Be careful of this code, it generates broadcasts. They can be eliminated by
using the IMPORT flag (set the third argument to 1), but then you need to
monitor the IMPORT Table to ensure that it is not overflowing. show_params
can do that for you.


FoxAPI is not much different. Instead of a Value Record, it has an IAXVAL
structure:

typedef union
{
   char  iacval;
   char  iabval;
   short iawval;
   int   iaival;
   long  ialval;
   float iarval;
   unsigned char  iaucval;
   unsigned short iauwval[2];
   unsigned int   iauival[2];
   unsigned long  iaulval[2];
   char  iasval[256+1];
}  IAXVAL;

Again, the boolean value (iabval; I/A Series Boolean Value) is the right
most bit of the left most byte of the union.

Here is a very old piece of code that used uwrite successfully on an INT
(it's so old that the 'official' IAXVAL did not exist. I still use mine
'cause I think it is easier to read, but...):

typedef
   union
   {
  char  cval;
  short int ival;
  float fval;
  char  bval;
  long  lval;
   } IAXVAL;

char name[1][32];
int  gw[1], error[1], nument, reterr, status[1], valtyp[1];

IAXVAL value[1];
/* Read the tank mass */
gw[0] = 1;
valtyp[0] = INT;
strcpy(name[0], flagName);
value[0].ival = 1;

nument = 1;
DebugPrint(LEVEL2_DEBUG, \tWriting the following object:\n);
DebugPrint(LEVEL2_DEBUG, \t\t%-32.32s type(%d) gw(%d)\n,
  name[0], valtyp[0], gw[0]);

errno=0;
reterr=0;
uwrite(gw, nument, name, valtyp, value, status, error, reterr);

Be careful with this code. AIS's one-shots did not use the IMPORT table and
generated broadcasts. FoxAPI does use the IMPORT table so if you use its
one-shot capability, be sure to check the IMPORT table using show_params.


Since I never use FoxAPI one-shot reads and write (uread/uwrite) on the
box, I can't give you a working code fragment for a Boolean. Sorry about
that.




 -Original Message-
 From: Sascha Wildner [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, March 21, 2000 9:37 AM
 To:   Foxboro DCS Mail List
 Subject:  Re: FoxAPI programming problems on AW70
 
 Cyrus,
 
 thanks for your answer.  That's interesting.  What exactly didn't work when
 you made the transition to 6.1?
 Did writing to the SWCH block parameters always fail or just sometimes?
 What function call did you use for writing?
 
 It's really weird.  I have noticed myself that writing doesn't always work.
 I have a program which writes the IN_1-5 parameters of BLNALM blocks in such
 a way that always one of those inputs is set and the others are 0.  If I
 test it here on my local AW70 in the internal station, it works fine.  If I
 go to the customer, it shows very strange behavior. 

Script Execution

2000-03-21 Thread Alan J Schaff

Does anyone have any experience with running a script triggered by an event in a
CP?  Ideally I want to trigger a script to run from sequence code or when a CIN
block goes true.

Thanks,
Alan Schaff
BASF Corp.






---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




RE: Script Execution

2000-03-21 Thread Loupe, Rory

Alan,
I am not sure about an event in the CP but I think this may suit your needs.

Utilize the following line to execute a program from sequence code:
:letterbugDMCMD:=dmcmd run pathname/program name;

For example, if the letterbug of the station is AW5101 and the program is
called program located in /opt/prog, use the following line:
:AW5101DMCMD:=dmcmd run /opt/prog/program;

Rory Loupe
Rhodia, Inc.
225-359-3748

-Original Message-
From:   Alan J Schaff [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, March 21, 2000 3:26 PM
To: Foxboro DCS Mail List
Subject:Script Execution

Does anyone have any experience with running a script
triggered by an event in a
CP?  Ideally I want to trigger a script to run from sequence
code or when a CIN
block goes true.

Thanks,
Alan Schaff
BASF Corp.








---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




FoxAPI programming problems on AW70

2000-03-21 Thread Sascha Wildner

x-html!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
HTMLHEAD
META content=text/html; charset=iso-8859-1 http-equiv=Content-Type
META content=MSHTML 5.00.2919.6307 name=GENERATOR
STYLE/STYLE
/HEAD
BODY bgColor=#ff
DIVFONT face=Arial size=2
DIVFONT face=Arial size=2Hello,/FONT/DIV
DIVnbsp;/DIV
DIVFONT face=Arial size=2has anyone succeeded in adding objects with 
read/write access to an application's CDX on the AW70 using the FoxAPI function 
an_add_objects()?nbsp;nbsp;Adding read only objects works fine, but read/write 
access fails although FoxDoc describes it and even gives an example program 
(which fails, too).nbsp; So I'm wondering who is wrong, the function's 
documentation or the example program./FONT/DIV
DIVFONT face=Arial size=2/FONTnbsp;/DIV
DIVFONT face=Arial size=2I have a small test program here which tries to add 
two RI parametersnbsp;of a CALC block to the CDX.nbsp; I could send it to 
anyone interested.nbsp; We've tried this program on virtually every FoxAPI 
version we could find and it always failed with return code 76 which is not 
mentioned by FoxDoc as a possible return code for an_add_objects().nbsp; 
foxapi.h defines it but the description there doesn't tell much since I don't 
pass any NULL pointers.nbsp; If you change 'rdwrit' to 'rdonly' (for access 
type) in the program, it works fine./FONT/DIV
DIVnbsp;/DIV
DIVFONT face=Arial size=2I could of course open a data set instead for 
writing but I'm reluctant because doing so givesnbsp;me those annoying command 
prompt windows flickering up briefly upon set opening and closing.nbsp; Data 
sets also stay open if someone kills the application with the task 
manager./FONT/DIV
DIVnbsp;/DIV
DIVFONT face=Arial size=2Regards,/FONT/DIV
DIVFONT face=Arial size=2Sascha 
Wildner/FONT/DIV/FONT/DIV/BODY/HTML
/x-html




RE: Script Execution

2000-03-21 Thread Schouten, Frits JF

Hi Alan, 
I do this all the time, starting scripts from sequence code that is :-))

Here is a snippet of sequence code:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SUBROUTINE INFO(  IN  time   : R
  p1 : I
  INOUT   flag   : B
  alarm  : B )
VARIABLES
 
STATEMENTS
 
flag  := FALSE;
SENDMSG(/opt/c1/ia/script/event.scr , p1) TO MSGGR1;
WAIT UNTIL flag AFTER time GOTO NEXT_INFO;
NEXT_INFO
 
IF (NOT flag) THEN
   {Alarm no coms with INFORMIX}
   alarm := TRUE;
ELSE
   alarm := FALSE;
ENDIF;
 
ENDSUBROUTINE
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
But there is more to this.
In the BLOCK you have to setup the MSGGRx. In our case: MSGGR1 = 2
In the COMPOUND you have to setup the device group. In our case : GR2DV1=EXE_MSG1
In the AP you have to have running  /opt/foxind/cpShell/exe/cpShell -id EXE_MSG1
The id could be any name you fancy as long as it is consistent throughout your system.
Make sure that you touch /opt/foxind/cpShell/status/EXE_MSG1 or whatever id you use.
The script on its turn starts a C program with embedded sql which record the event 
sent by seq. code.
Once processed it sets a boolean in the sequence code to let it know it has been 
processed.

This all to get real time events (well close to it) to Level4 for synchronous 
production between plants.

I can find hundreds of pieces of sequence code on our systems that utilise the above 
structure
and they all work a gem.

That's about all, I think.

Cheers,
Frits Schouten
BHP-NZSteel.

 -Original Message-
 From: Alan J Schaff [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, 22 March 2000 09:26
 To:   Foxboro DCS Mail List
 Subject:  Script Execution
 
 Does anyone have any experience with running a script triggered by an event in a
 CP?  Ideally I want to trigger a script to run from sequence code or when a CIN
 block goes true.
 
 Thanks,
 Alan Schaff
 BASF Corp.
 
 
 
 
 
 

---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




RE: Script Execution

2000-03-21 Thread Johnson,Alex

Alan,

There are a number of option:

1) Write a program
2) Buy a program
3) Use a package that includes this functionality
4) Use a kludge base on the WP.

Personally, I think option 2) is the best bet, but tastes (and budgets
differ) so here is some food for thought.

As always. Free advice is worth what you paid for it.

Regards,

AJ


 Various ways to exectute a script **
The I/A Series uses a program called 'mles', My Little Exectution Server for
the trivial buffs out there, but the protocol has never been published.

I (and many others) have written programs to register a PROCESS name with
the OM and wait for messages. Mine is called cpShell, but there are others.
You can find the information on how to use Foxboro Inter-Process
commnication (IPC) calls in Inter-Process Communications Calls (B0193BB).
Done properly, this mechanism can actually acknowledge to the CP that the
command has been executed. (One uses SENDACK and sets up to have the script
acknowledge the action.)

RBatch offered this capability as a standard part of its functionality.

You can use a WP to do it as shown from this excerpt from my (non-published,
sigh...) book 'Applying the I/A Series':

 Danger. Free advice begins here. Use good judgement before
proceeding. ***

Most people do not realize that many of the WP globals are also OM
variables. One such is DMCMD. Once each second, the DM/FV checks its DMCMD
for a command string and if there is one executes it.

The OM name of a DM's DMCMD variable is 'dmnameDMCMD', e.g., WP0001's
DMCMD is WP0001DMCMD.

Since it is a OM variable, the DMCMDs can be set from within a sequence
block as follows:

:WP0001DMCMD := dmcmd e /usr/customer/Initial_Disp;

Here is an example of a program that waits on an event and sends a command
to a DM.

CONSTANTS

VARIABLES

WP : S12[10]; {Array of WP letterbugs}
WPLBUG : S12; {The DMCMD variable for the target WP}

USER_LABELS

DESTCRT : II0001; {Requested Target WP's number in this console}
DISPNO  : II0002; {Encoded Display Name and Default WP}

TARGET  : IO0001; {Actual Target WP's number in this console}
KEY : IO0002; {Key number}
PANEL   : IO0003; {Panel number}

WP01: SN0001; {Letterbug of the Default WP in this console}
WP02: SN0002; {Letterbug of the Second WP in this console}
WP03: SN0003; {Letterbug of the Third WP in this console}
WP04: SN0004; {Letterbug of the Fourth WP in this console}
WP05: SN0005; {Letterbug of the Fifth WP in this console}
WP06: SN0006; {Letterbug of the Sixth WP in this console}
WP07: SN0007; {Letterbug of the Seventh WP in this console}
WP08: SN0008; {Letterbug of the Eighth WP in this console}
WP09: SN0009; {Letterbug of the Ninth WP in this console}
WP10: SN0010; {Letterbug of the Tenth WP in this console}

STATEMENTS

{Fill the WP array with the letterbugs of the WPs in the consoles}
WP[01] := WP01;
WP[02] := WP02;
WP[03] := WP03;
WP[04] := WP04;
WP[05] := WP05;
WP[06] := WP06;
WP[07] := WP07;
WP[08] := WP08;
WP[09] := WP09;
WP[10] := WP10;

CHECK

{Wait until a WP is specified or a display is specified}
WAIT UNTIL ((DESTCRT  0) OR (DISPNO  0));

{If the target WP is non-zero, wait for a display to be specified.
If no display is specified in a short amount of time, start over}
IF (DESTCRT  0) THEN
WAIT UNTIL (DISPNO  0) AFTER 10 GOTO CLEANUP;
ENDIF;

{Determine from DISPNO the display to call up}
KEY := DISPNO MOD 100;
PANEL := (DISPNO MOD 1 - KEY) DIV 100;

{If a Target WP is not specified, use the default as encoded}
IF (DESTCRT = 0) THEN
TARGET = DISPNO DIV 1;
ELSE
TARGET = DESTCRT;
ENDIF;

*** HERE'S THE GOOD STUFF *
{Send a command to the WP to raise the display}
WPLBUG := WP[CRTNO],DMCMD;
:'WPLBUG' := e /usr/applic/dspRedir/,NAME,/WP,TARGET-1,/P,PANEL,/K,KEY;
*** DONE WITH GOOD STUFF  *

CLEANUP
DESTCRT := 0;
DISPNO  := 0;

GOTO CHECK;
ENDSEQUENCE


A couple of caveats:

1) The WP might be down. If that happens you will get an error that needs to
be trapped by the Sequence Block.
2) Other programs are setting DMCMD too. Since the DM/FV only checks the
contents of DMCMD once each second,
you may have your command overwritten by someone elses or vice versa.
Therefore, you need to build a confirmation
mechanism into your code.

The ICC manuals (Integrated Control Configurator (B0193AV) and Integrated
Control Software Concepts (B0193AW) ) covers the Sequence Block language,
but here is an example of how to trap 

RE: Script Execution

2000-03-21 Thread Johnson,Alex

So, are you going to tell him how to get cpShell?

:)

AJ

 -Original Message-
 From: Schouten, Frits JF [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, March 21, 2000 4:04 PM
 To:   'Foxboro DCS Mail List'
 Subject:  RE: Script Execution
 
 Hi Alan, 
 I do this all the time, starting scripts from sequence code that is :-))
 
 Here is a snippet of sequence code:
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 SUBROUTINE INFO(  IN  time   : R
   p1 : I
   INOUT   flag   : B
   alarm  : B )
 VARIABLES
  
 STATEMENTS
  
 flag  := FALSE;
 SENDMSG(/opt/c1/ia/script/event.scr , p1) TO MSGGR1;
 WAIT UNTIL flag AFTER time GOTO NEXT_INFO;
 NEXT_INFO
  
 IF (NOT flag) THEN
{Alarm no coms with INFORMIX}
alarm := TRUE;
 ELSE
alarm := FALSE;
 ENDIF;
  
 ENDSUBROUTINE
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 But there is more to this.
 In the BLOCK you have to setup the MSGGRx. In our case: MSGGR1 = 2
 In the COMPOUND you have to setup the device group. In our case :
 GR2DV1=EXE_MSG1
 In the AP you have to have running  /opt/foxind/cpShell/exe/cpShell -id
 EXE_MSG1
 The id could be any name you fancy as long as it is consistent throughout
 your system.
 Make sure that you touch /opt/foxind/cpShell/status/EXE_MSG1 or whatever
 id you use.
 The script on its turn starts a C program with embedded sql which record
 the event sent by seq. code.
 Once processed it sets a boolean in the sequence code to let it know it
 has been processed.
 
 This all to get real time events (well close to it) to Level4 for
 synchronous production between plants.
 
 I can find hundreds of pieces of sequence code on our systems that utilise
 the above structure
 and they all work a gem.
 
 That's about all, I think.
 
 Cheers,
 Frits Schouten
 BHP-NZSteel.
 
  -Original Message-
  From:   Alan J Schaff [SMTP:[EMAIL PROTECTED]]
  Sent:   Wednesday, 22 March 2000 09:26
  To: Foxboro DCS Mail List
  Subject:Script Execution
  
  Does anyone have any experience with running a script triggered by an
 event in a
  CP?  Ideally I want to trigger a script to run from sequence code or
 when a CIN
  block goes true.
  
  Thanks,
  Alan Schaff
  BASF Corp.


---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]




RE: Script Execution

2000-03-21 Thread Schouten, Frits JF

I don't know... Our local FOXBORO supplier, maybe, I suppose, who got it 
from FoxSingapore, who got it from. I don't know...
But I think it originates from, what's that chap's name Alex something, or 
so. :-))

Credit where credit is due.
Good job Alex.
I've treasured it from the day it was installed in the mid nineties (sounds a 
long time ago, doesn't it) and here we are running it under Ver.6.1

Cheers,
Frits.


 -Original Message-
 From: Johnson,Alex [SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, 22 March 2000 10:18
 To:   Foxboro DCS Mail List
 Subject:  RE: Script Execution
 
 So, are you going to tell him how to get cpShell?
 
 :)
 
 AJ
 
  -Original Message-
  From:   Schouten, Frits JF [SMTP:[EMAIL PROTECTED]]
  Sent:   Tuesday, March 21, 2000 4:04 PM
  To: 'Foxboro DCS Mail List'
  Subject:RE: Script Execution
  
  Hi Alan, 
  I do this all the time, starting scripts from sequence code that is :-))
  
  Here is a snippet of sequence code:
  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  SUBROUTINE INFO(  IN  time   : R
p1 : I
INOUT   flag   : B
alarm  : B )
  VARIABLES
   
  STATEMENTS
   
  flag  := FALSE;
  SENDMSG(/opt/c1/ia/script/event.scr , p1) TO MSGGR1;
  WAIT UNTIL flag AFTER time GOTO NEXT_INFO;
  NEXT_INFO
   
  IF (NOT flag) THEN
 {Alarm no coms with INFORMIX}
 alarm := TRUE;
  ELSE
 alarm := FALSE;
  ENDIF;
   
  ENDSUBROUTINE
  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  But there is more to this.
  In the BLOCK you have to setup the MSGGRx. In our case: MSGGR1 = 2
  In the COMPOUND you have to setup the device group. In our case :
  GR2DV1=EXE_MSG1
  In the AP you have to have running  /opt/foxind/cpShell/exe/cpShell -id
  EXE_MSG1
  The id could be any name you fancy as long as it is consistent throughout
  your system.
  Make sure that you touch /opt/foxind/cpShell/status/EXE_MSG1 or whatever
  id you use.
  The script on its turn starts a C program with embedded sql which record
  the event sent by seq. code.
  Once processed it sets a boolean in the sequence code to let it know it
  has been processed.
  
  This all to get real time events (well close to it) to Level4 for
  synchronous production between plants.
  
  I can find hundreds of pieces of sequence code on our systems that utilise
  the above structure
  and they all work a gem.
  
  That's about all, I think.
  
  Cheers,
  Frits Schouten
  BHP-NZSteel.
  
   -Original Message-
   From: Alan J Schaff [SMTP:[EMAIL PROTECTED]]
   Sent: Wednesday, 22 March 2000 09:26
   To:   Foxboro DCS Mail List
   Subject:  Script Execution
   
   Does anyone have any experience with running a script triggered by an
  event in a
   CP?  Ideally I want to trigger a script to run from sequence code or
  when a CIN
   block goes true.
   
   Thanks,
   Alan Schaff
   BASF Corp.

---
This list is neither sponsored nor endorsed by the Foxboro Company. All 
postings from this list are the work of list subscribers and no warranty 
is made or implied as to the accuracy of any information disseminated 
through this medium. By subscribing to this list you agree to hold the 
list sponsor(s) blameless for any and all mishaps which might occur due to 
your application of information received from this mailing list.

To be removed from this list, send mail to 
[EMAIL PROTECTED] 
with unsubscribe foxboro in the Subject. Or, send any mail to
[EMAIL PROTECTED]