Re: [foxboro] HLBL User Labels

  • From: "Jones, Charles R. \(Chuck\)" <Chuck.Jones@xxxxxxxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Fri, 1 Sep 2006 11:23:54 -0400

I believe you are correct, Andreas, about the correct way to return a
variable.  But, I don't think the original author, Daniel Klebba, wanted
the variable returned directly.  He just wanted to pass a USER_LABEL to
the subroutine then change its value.  (Perhaps the value would be
called via the USER_LABEL later, and thus would be returned indirectly.
But, that is not part of the puzzle we were given.) =20

The problem in the original code is that the variable "Label" is defined
as a string, so even if it accepted the Boolean value of TRUE (I doubt
it, but haven't tried it), it would likely still not produce the desired
result.  So, the problem was not that a USER_LABEL cannot be passed via
subroutine parameter (which may be done), but that it was the wrong
variable type when it got there.  David Johnson's solution changed the
variable type of the subroutine to match the variable type of the
USER_LABEL.  I think another possible solution that still uses a string
variable is to define the string as an external reference (e.g.--
":THIS_BLOCK.BO0001"). Then, this should work:

SUBROUTINE CHNG_OUTPUT (IN Label :S)
        :'Label' :=3D TRUE;     {set the Boolean output to TRUE}
      /* note that the first colon (:) cannot be included in the string
variable */
ENDSUBROUTINE=20

But, it is not a very clean solution at all.  I try to avoid external
references whenever possible.  Also, my suggestion goes past Daniel's
original request and uses the block parameter instead of the USER_LABEL
name.  I like David's solution of changing the function parameter from
string to Boolean better, so I didn't suggest this yesterday.  I don't
suggest that anyone use it today, either. :)

Chuck Jones
Automation Technologist
Tate & Lyle -- Lafayette South Plant
765.477.5324 - Office  | 765.586.5290 - Cell




-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx]
On Behalf Of Weiss, Andreas
Sent: Friday, September 01, 2006 8:06 AM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] HLBL User Labels


Hi,

wouldn't it been required to change

SUBROUTINE CHNG_OUTPUT (IN Label :S)
        Label   :=3D3D TRUE;    {set the Boolean output to TRUE}
ENDSUBROUTINE


into

SUBROUTINE CHNG_OUTPUT (INOUT Label :S)  {use INOUT instead of only IN}
        Label   :=3D3D TRUE;    {set the Boolean output to TRUE}
ENDSUBROUTINE

???

to write the value of label back to your user label variable.

Regards,
Andreas
=20
=20
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
=20
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
=20
***************************************************************************=
**************************
This email and any files transmitted with it are confidential and intended =
solely for the=20
use of the individual or entity to whom they are addressed. If you are not =
the intended=20
recipient or the person responsible for delivering the email to the intende=
d recipient, be=20
advised that you have received this email in error that any use, disseminat=
ion,=20
forwarding, printing, or copying of this email is strictly prohibited.  If =
you have received=20
this email in error please notify the sender immediately. Please note that =
we reserve=20
the right to monitor and read any emails sent and received by the Company i=
n=20
accordance with and to the extent permitted by applicable legal rules.
***************************************************************************=
**************************
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: