HGET

Return information about an object

Description:

This application returns many different pieces of information depending on the value of the ITEM parameter.
Item code Returned type Description
PRIMITIVE _LOGICAL True if Object primitive
STRUCTURED _LOGICAL True if Object structured
NDIM _INTEGER Dimensionality
DIMS _CHAR Dimensions separated by commas
NELM _INTEGER Total number of elements
TYPE _CHAR Object type
VALUE Object type Object value (primitive scalar only)
MIN, MAX _REAL Min,max values in numeric array

The internal parameter ATTR is set to the requested value and, if ECHO is TRUE, the value is displayed on the users terminal.

For items MIN and MAX, internal parameter INDEX is also set (but not displayed).

The application is particularly useful from ICL, where the values of the ATTR and INDEX parameters can be returned into ICL variables and thus used to control applications. Note however that a character value cannot be returned into a variable that has already been defined as a numeric type.

Usage:

hget inp item [attr] [index] [echo=] [version=]

Parameters:

INP = UNIV (Read)
Object to be interrogated. <GLOBAL.HDSOBJ >
ITEM = _CHAR (Read)
Item wanted (see Description). Case is not significant and the value may be abbreviated. <VALUE >
ATTR = UNIV (Write)
Attribute value.
INDEX = _INTEGER (Write)
The index position of the max or min value (treating arrays as vectors).
ECHO = _LOGICAL (Read)
Echo attribute value to standard output stream? [TRUE]
VERSION = _LOGICAL (Read)
Whether application version number is to be output. If the MSG_FILTER environment variable is set to 1, output will not occur anyway. [FALSE]

Examples:

% hget numvec(2) value
Displays the value of the second element of object numvec
% hget file.data_array.data max attr=@info.max noecho
Writes the maximum value of the DATA component of the DATA_ARRAY component of file into the MAX component of file info. The value will not be displayed.
ICL > hget numvec min (minval) (index) echo=f
ICL > =index
Sets the ICL variable minval to the minimum value in vector numvec, and variable index to the position of the minimum value within numvec. The minimum value will not be displayed but the second ICL command will display the index.

Notes:

Internal parameters (ATTR and INDEX) are not saved in the tasks parameter file. Their values can be written to HDS objects by specifying the name of an existing object of a suitable type on the command line. The object name must be preceded by @ for the ATTR parameter but this is not necessary for INDEX (see Example 2).