# NAG FL Interfaceg22znf (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 4 in How to Use the NAG Library for further information.

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine g22znf (
 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
#include <nag.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)
The routine may be called by the names g22znf or nagf_blgm_optget.

## 3Description

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 ‘$\mathit{option}:\mathit{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.

None.

## 5Arguments

1: $\mathbf{handle}$Type (c_ptr) Input
On entry: the G22 handle which must have been initialized by one of Chapter G22's initialization routines.
2: $\mathbf{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, ${\mathbf{ifail}}={\mathbf{124}}$ is returned.
$\mathit{option}:\mathit{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: $\mathbf{ivalue}$Integer Output
On exit: if ${\mathbf{optype}}=1$, option identifies an integer-valued optional parameter and ivalue holds its current value.
4: $\mathbf{rvalue}$Real (Kind=nag_wp) Output
On exit: if ${\mathbf{optype}}=2$, option identifies a real-valued optional parameter and rvalue holds its current value.
5: $\mathbf{cvalue}$Character(*) Output
Note: the string returned in cvalue will never exceed $40$ characters in length.
On exit: if ${\mathbf{optype}}=3$, option identifies a character-valued optional parameter and cvalue holds its current value.
6: $\mathbf{optype}$Integer Output
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.
${\mathbf{optype}}=1$
option is an integer-valued optional parameter; its current value has been returned in ivalue.
${\mathbf{optype}}=2$
option is a real-valued optional parameter; its current value has been returned in rvalue.
${\mathbf{optype}}=3$
option is a character-valued optional parameter; its current value has been returned in cvalue.
7: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=11$
handle has not been initialized or is corrupt.
${\mathbf{ifail}}=12$
handle is not a G22 handle.
${\mathbf{ifail}}=21$
On entry, option was not recognized: ${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=22$
On entry, option is not readable: ${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
${\mathbf{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.
${\mathbf{ifail}}=121$
Invalid instance identifier for option.
On entry, ${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=122$
Numeric instance identifier is out of range.
On entry, $\mathit{instance identifier}=〈\mathit{\text{value}}〉$.
Constraint: $〈\mathit{\text{value}}〉\le \mathit{instance identifier}$ and $\mathit{instance identifier}\le 〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=123$
On entry, option cannot have an associated instance identifier. The supplied instance identifier was ignored.
${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
${\mathbf{ifail}}=124$
option has multiple instances. Information from the first instance has been returned.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

g22znf is not threaded in any implementation.