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  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: print all information about a PV including units
From: "Johnson, Andrew N. via Tech-talk" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Wed, 20 Feb 2019 18:01:51 +0000
On 2/20/19 9:10 AM, Marty Kraimer via Tech-talk wrote:
Strange things can happen if you try to create a record with a '.' in the record name.
True; recent versions of Base print a warning message if they find a '.' in a record name, although they do allow the record to be created:

tux% base-3.14.12.5/bin/linux-x86_64/softIoc -x anj.1
Bad character '.' in record name "anj.1:exit"
Starting iocInit
############################################################################
## EPICS R3.14.12.5 2015/03/25 16:02:19
## EPICS Base built Apr 14 2015
############################################################################
iocRun: All initialization complete
epics> dbl
anj.1:exit
However it is not possible to access that record over Channel Access:
tux% cainfo anj.1:exit
Channel connect timed out: 'anj.1:exit' not found.

However I think the '.' issue is a red herring, i.e. not really relevant to the original question, which was this:

On 190220-1321, rachid ayad via Tech-talk wrote:
I would like to ask you how print wide information about a PV using the
epics command cainfo. For example a cainfo shell command gives:
**************
cainfo BMH:MQC2LE:POS.PXP
BMH:MQC2LE:POS.PXP
     State:            connected
     Host:             abcob02.kek.jp:5064<http://abcob02.kek.jp:5064>
     Access:           read, no write
     Native data type: DBF_DOUBLE
     Request type:     DBR_DOUBLE
     Element count:    1
*************
without units and I tried all options given in "caninfo -h" but did not
work. I found I can do it in a C code to print the val structure but I need
it in shell command
To answer that question: The cainfo program can't print any more information than it shows above. However you can use some of the options with caget to find out more. If we look at the help for caget it shows the different data types that you can request for a channel using the -d option:

tux% caget -h

Usage: caget [options] <PV name> ...

  -h: Help: Print this message
  -V: Version: Show EPICS and CA versions
Channel Access options:
  -w <sec>: Wait time, specifies CA timeout, default is 1.000000 second(s)
  -c: Asynchronous get (use ca_get_callback and wait for completion)
  -p <prio>: CA priority (0-99, default 0=lowest)
Format options:
      Default output format is "name value"
  -t: Terse mode - print only value, without name
  -a: Wide mode "name timestamp value stat sevr" (read PVs as DBR_TIME_xxx)
  -d <type>: Request specific dbr type; use string (DBR_ prefix may be omitted)
      or number of one of the following types:
 DBR_STRING     0  DBR_STS_FLOAT    9  DBR_TIME_LONG   19  DBR_CTRL_SHORT    29
 DBR_INT        1  DBR_STS_ENUM    10  DBR_TIME_DOUBLE 20  DBR_CTRL_INT      29
 DBR_SHORT      1  DBR_STS_CHAR    11  DBR_GR_STRING   21  DBR_CTRL_FLOAT    30
 DBR_FLOAT      2  DBR_STS_LONG    12  DBR_GR_SHORT    22  DBR_CTRL_ENUM     31
 DBR_ENUM       3  DBR_STS_DOUBLE  13  DBR_GR_INT      22  DBR_CTRL_CHAR     32
 DBR_CHAR       4  DBR_TIME_STRING 14  DBR_GR_FLOAT    23  DBR_CTRL_LONG     33
 DBR_LONG       5  DBR_TIME_INT    15  DBR_GR_ENUM     24  DBR_CTRL_DOUBLE   34
 DBR_DOUBLE     6  DBR_TIME_SHORT  15  DBR_GR_CHAR     25  DBR_STSACK_STRING 37
 DBR_STS_STRING 7  DBR_TIME_FLOAT  16  DBR_GR_LONG     26  DBR_CLASS_NAME    38
 DBR_STS_SHORT  8  DBR_TIME_ENUM   17  DBR_GR_DOUBLE   27
 DBR_STS_INT    8  DBR_TIME_CHAR   18  DBR_CTRL_STRING 28
Enum format:
  -n: Print DBF_ENUM value as number (default is enum string)
Arrays: Value format: print number of requested values, then list of values
  Default:    Print all values
  -# <count>: Print first <count> elements of an array
  -S:         Print array of char as a string (long string)
Floating point type format:
  Default: Use %g format
  -e <nr>: Use %e format, with a precision of <nr> digits
  -f <nr>: Use %f format, with a precision of <nr> digits
  -g <nr>: Use %g format, with a precision of <nr> digits
  -s:      Get value as string (honors server-side precision)
  -lx:     Round to long integer and print as hex number
  -lo:     Round to long integer and print as octal number
  -lb:     Round to long integer and print as binary number
Integer number format:
  Default: Print as decimal number
  -0x: Print as hex number
  -0o: Print as octal number
  -0b: Print as binary number
Alternate output field separator:
  -F <ofs>: Use <ofs> as an alternate output field separator

Example: caget -a -f8 my_channel another_channel
  (uses wide output format, doubles are printed as %f with precision of 8)

The data type with the most metadata fields is DBR_CTRL_DOUBLE, so this command prints out the most information available through CA for a DOUBLE channel:
tux% caget -d DBR_CTRL_DOUBLE anj:exit.A
anj:exit.A
    Native data type: DBF_DOUBLE
    Request type:     DBR_CTRL_DOUBLE
    Element count:    1
    Value:            0
    Status:           UDF
    Severity:         INVALID
    Units:            
    Precision:        0
    Lo disp limit:    0
    Hi disp limit:    0
    Lo alarm limit:   nan
    Lo warn limit:    nan
    Hi warn limit:    nan
    Hi alarm limit:   nan
    Lo ctrl limit:    -1e+300
    Hi ctrl limit:    1e+300
However this type does not include the record's timestamp, for which you have to use one of the DBR_TIME_ data types:
tux% caget -d DBR_TIME_DOUBLE anj:exit.A
anj:exit.A
    Native data type: DBF_DOUBLE
    Request type:     DBR_TIME_DOUBLE
    Element count:    1
    Value:            0
    Timestamp:        <undefined>
    Status:           UDF
    Severity:         INVALID
My particular record's Timestamp is undefined and it is in a UDF/INVALID state because it has not been processed since I started the IOC.

If you want to see the values of the individual record fields, you can use the capr.pl Perl script that comes with recent versions of Base (but won't run on Windows because it uses the Perl CA bindings which are not supported there). The output from this script is meant to be similar to the 'dbpr' IOC shell command, including the optional interest-level argument:
tux% capr anj:exit
Using /home/anj/base-7.0.2/bin/linux-x86_64/../../dbd/capr.dbd

anj:exit is record type sub
A:    0.00000000    ASG:                B:    0.00000000    C:    0.00000000    
D:    0.00000000    DESC: Exit subroutine                   DISA: 0             
DISP: 0             DISV: 1             E:    0.00000000    F:    0.00000000    
G:    0.00000000    H:    0.00000000    I:    0.00000000    J:    0.00000000    
K:    0.00000000    L:    0.00000000    NAME: anj:exit      SEVR: INVALID       
STAT: UDF           TPRO: 0             VAL:  0.00000000    
tux% capr anj:exit 1
Using /home/anj/base-7.0.2/bin/linux-x86_64/../../dbd/capr.dbd

anj:exit is record type sub
A:    0.00000000    ADEL: 0.00000000    ASG:                B:    0.00000000    
BRSV: NO_ALARM      C:    0.00000000    D:    0.00000000    
DESC: Exit subroutine                   DISA: 0             DISP: 0             
DISS: NO_ALARM      DISV: 1             E:    0.00000000    EGU:                
EVNT: 0             F:    0.00000000    FLNK:               G:    0.00000000    
H:    0.00000000    HHSV: NO_ALARM      HIGH: 0.00000000    HIHI: 0.00000000    
HOPR: 0.00000000    HSV:  NO_ALARM      HYST: 0.00000000    I:    0.00000000    
INAM:               INPA:               INPB:               INPC:               
INPD:               INPE:               INPF:               INPG:               
INPH:               INPI:               INPJ:               INPK:               
INPL:               J:    0.00000000    K:    0.00000000    L:    0.00000000    
LLSV: NO_ALARM      LOLO: 0.00000000    LOPR: 0.00000000    LOW:  0.00000000    
LSV:  NO_ALARM      MDEL: 0.00000000    NAME: anj:exit      PACT: 0             
PHAS: 0             PINI: NO            PREC: 0             PRIO: LOW           
PUTF: 0             RPRO: 0             SCAN: Passive       SDIS:               
SEVR: INVALID       SNAM: exit          STAT: UDF           TPRO: 0             
TSE:  0             TSEL:               UDF:  1             VAL:  0.00000000   

HTH,

- Andrew
-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

Replies:
Re: print all information about a PV including units rachid ayad via Tech-talk
References:
print all information about a PV including units rachid ayad via Tech-talk
Re: print all information about a PV including units Dr. Bastian Löher via Tech-talk
Re: print all information about a PV including units rachid ayad via Tech-talk
Re: print all information about a PV including units Mark Rivers via Tech-talk
Re: print all information about a PV including units Marty Kraimer via Tech-talk

Navigate by Date:
Prev: Re: Question about rdb channel archive Florian Feldbauer via Tech-talk
Next: Re: print all information about a PV including units rachid ayad via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: print all information about a PV including units Marty Kraimer via Tech-talk
Next: Re: print all information about a PV including units rachid ayad via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 20 Feb 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·