X04 Chapter Contents
X04 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentX04AAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

X04AAF returns the value of the current error message unit number, or sets the current error message unit number to a new value.

## 2  Specification

 SUBROUTINE X04AAF ( IFLAG, NERR)
 INTEGER IFLAG, NERR

## 3  Description

X04AAF enables those library routines which output error messages, to determine the number of the output unit to which the error messages are to be sent; in this case X04AAF is called with ${\mathbf{IFLAG}}=0$. X04AAF may also be called with ${\mathbf{IFLAG}}=1$ to set the unit number to a specified value. Otherwise a default value (stated in the Users' Note for your implementation) is returned.
Records written to this output unit by other library routines are at most $80$ characters long (including a line-printer carriage control character).
Note that if the unit number is set $\text{}<0$, no messages will be output.

None.

## 5  Parameters

1:     IFLAG – INTEGERInput
On entry: the action to be taken (see NERR).
Constraint: ${\mathbf{IFLAG}}=0$ or $1$.
2:     NERR – INTEGERInput/Output
On entry: if ${\mathbf{IFLAG}}=0$, NERR need not be set.
If ${\mathbf{IFLAG}}=1$, NERR must specify the new error message unit number.
On exit: if ${\mathbf{IFLAG}}=0$, NERR is set to the current error message unit number.
If ${\mathbf{IFLAG}}=1$, NERR is unchanged.
Note that Fortran unit numbers must be positive or zero. If NERR is set $\text{}<0$, output of error messages is totally suppressed.

None.

## 7  Accuracy

Not applicable.

The time taken by X04AAF is negligible.

## 9  Example

In this example X04AAF is called by your main program to make the error message from the routine DUMMY appear on the same unit as the rest of the output (unit $6$). Normally a NAG Library routine with an IFAIL parameter (see Section 3.3.2 in the Essential Introduction) would take the place of DUMMY.

### 9.1  Program Text

Program Text (x04aafe.f90)

None.

### 9.3  Program Results

Program Results (x04aafe.r)