NAG Library Routine Document

g22znf (optget)

Note: please be advised that this routine is classed as ‘experimental’ and its interface may be developed further in the future. Please see Section 3.1.1 in How to Use the NAG Library and its Documentation for further information.

1
Purpose

g22znf is a general option getting routine for Chapter G22. It is used to query the value of optional parameters.

2
Specification

Fortran Interface
Subroutine g22znf ( handle, optstr, ivalue, rvalue, cvalue, optype, ifail)
Integer, Intent (Inout):: ifail
Integer, Intent (Out):: ivalue, optype
Real (Kind=nag_wp), Intent (Out):: rvalue
Character (*), Intent (In):: optstr
Character (*), Intent (Out):: cvalue
Type (c_ptr), Intent (In):: handle
C Header Interface
#include <nagmk26.h>
void  g22znf_ (void **handle, const char *optstr, Integer *ivalue, double *rvalue, char *cvalue, Integer *optype, Integer *ifail, const Charlen length_optstr, const Charlen length_cvalue)

3
Description

g22znf can only be called on G22 handles. It can be used to query the current values of optional parameters and will return either an integer, real or character value dependent upon the type associated with the optional parameter being queried.
The optional parameter of interest is presented as a character string of the form ‘option
In cases where an optional parameter may have multiple instances in a particular G22 handle an instance identifier can be specified. This is presented using the form ‘option:instance identifier’. In such cases, if the instance identifier is omitted, the value of the first instance is returned. If the value of optional parameter is not the same for all instances and an instance identifier is omitted, a warning is raised.
Information relating to available option names, their corresponding valid values, whether the use of an instance identifier may be appropriate and what form it can take is given in the individual routine documents.

4
References

None.

5
Arguments

1:     handle – Type (c_ptr)Input
On entry: the G22 handle which must have been initialized by one of Chapter G22's initialization routines.
2:     optstr – Character(*)Input
On entry: a string identifying the option and, where required, the instance identifier.
identify
Returns a string description of the G22 handle supplied in handle. See Section 9 for more details.
option
Returns the value of option. If there are multiple instances of option, the value of the first is returned. If not all instances of option have the same value, ifail=124 is returned.
option:instance identifier
Returns the value of a single instance of option.
optstr is case insensitive and option and instance identifier may consist of one or more tokens separated by white space.
See the documentation of the individual Chapter G22 routines for details of valid values for option and instance identifier.
3:     ivalue – IntegerOutput
On exit: if optype=1, option identifies an integer-valued optional parameter and ivalue holds its current value.
4:     rvalue – Real (Kind=nag_wp)Output
On exit: if optype=2, option identifies a real-valued optional parameter and rvalue holds its current value.
5:     cvalue – Character(*)Output
Note: the string returned in cvalue will never exceed 40 characters in length.
On exit: if optype=3, option identifies a character-valued optional parameter and cvalue holds its current value.
6:     optype – IntegerOutput
On exit: indicates whether option is an integer, real or character-valued optional parameter and hence which of ivalue, rvalue or cvalue holds the current value.
optype=1
option is an integer-valued optional parameter; its current value has been returned in ivalue.
optype=2
option is a real-valued optional parameter; its current value has been returned in rvalue.
optype=3
option is a character-valued optional parameter; its current value has been returned in cvalue.
7:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=11
handle has not been initialized or is corrupt.
ifail=12
handle is not a G22 handle.
ifail=21
On entry, option was not recognized: optstr=value.
ifail=22
On entry, option is not readable: optstr=value.
ifail=51
On entry, option is a character optional parameter, but cvalue is too short to hold the stored value. The minimum number of characters to store the value is returned in ivalue. The value returned in cvalue will be truncated.
ifail=121
Invalid instance identifier for option.
On entry, optstr=value.
ifail=122
Numeric instance identifier is out of range.
On entry, instance identifier=value.
Constraint: valueinstance identifier and instance identifiervalue.
ifail=123
On entry, option cannot have an associated instance identifier. The supplied instance identifier was ignored.
optstr=value.
ifail=124
option has multiple instances. Information from the first instance has been returned.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

g22znf is not threaded in any implementation.

9
Further Comments

When optstr is set to identify, the following return values are possible:
Model Formula
G22 handle was returned by g22yaf in hform.
Data Matrix Description
G22 handle was returned by g22ybf in hddesc.
Design Matrix Description
G22 handle was returned by g22ycf in hxdesc.

10
Example

See the example for g22yaf.