EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: About subArray trailing zeros
From: Andrew Johnson <[email protected]>
To: [email protected]
Cc: "Zhang, Jihong \(Julia\)" <[email protected]>
Date: Wed, 19 Jan 2011 11:03:58 -0600
Hi Julia,

On Tuesday 18 January 2011 15:52:18 Zhang, Jihong (Julia) wrote:
>
> I have a question on the trailing zeros. why does caget report trailing
> zeros; is this a bug?

No it's normal, but you can prevent it.

> caget subArr1
> subArr1 16 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0
> /* I only need the first 4 numbers, no training 0 */

If you know you only need 4 elements and don't want the trailing zeros you 
should only request 4:
  caget -# 4
  subArr1 4 1 2 3 4

Alternatively if you're using Base version 3.14.12 you can make use of the new 
dynamic array sizing feature to request just the elements that are currently 
defined, like this:
  caget -c subArr1
  subArr1 4 1 2 3 4

The latter approach allows you to change the number of elements on the IOC 
without having to change your client code, but it only works with both 3.14.12 
IOCs and CA clients.

Zenon Szalata wrote:
> Looks like you have dimensioned your subArrays to have 16 elements.  caget
> reports all 16 values even if only first four have been populated.

A subArray record usually has to have MALM configured large enough to hold the 
whole waveform, so she has no choice about that.

Note that the behavior of the subArray record type was changed slightly in the 
3.14.10 release; earlier versions did not implement one of the record support 
interface routines correctly.  They were reporting the maximum number of 
elements for the VAL field as NELM, so against an IOC before 3.14.10 the 
cagets above would only have displayed 4 elements.  Unfortunately since NELM 
can be changed at runtime that could cause some clients to crash.

- Andrew
-- 
If a man is offered a fact which goes against his instincts, he will
scrutinize it closely, and unless the evidence is overwhelming, he will
refuse to believe it.  If, on the other hand, he is offered something
which affords a reason for acting in accordance to his instincts, he
will accept it even on the slightest evidence.  -- Bertrand Russell


References:
About subArray trailing zeros Zhang, Jihong (Julia)

Navigate by Date:
Prev: Re: Building base-3.14.12 for a specific target J. Lewis Muir
Next: Problem exiting IOC Vigder, Mark
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: About subArray trailing zeros Szalata, Zenon M.
Next: LabVIEW-to-Epics-interface for Linux and Windows - CA Lab Carsten Winkler (HZB)
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·