UMACH
Routine UMACH sets or retrieves the input, output, or error output device unit numbers.
Required Arguments
N — Integer value indicating the action desired. If the value of N is negative, the input, output, or error output unit number is reset to NUNIT. If the value of N is positive, the input, output, or error output unit number is returned in NUNIT. See the table in argument NUNIT for legal values of N. (Input)
NUNIT — The unit number that is either retrieved or set, depending on the value of input argument N. (Input/Output)
The arguments are summarized by the following table:
N |
Effect |
1 |
Retrieves input unit number in NUNIT. |
2 |
Retrieves output unit number in NUNIT. |
3 |
Retrieves error output unit number in NUNIT. |
–1 |
Sets the input unit number to NUNIT. |
–2 |
Sets the output unit number to NUNIT. |
–3 |
Sets the error output unit number to NUNIT. |
FORTRAN 90 Interface
Generic: CALL UMACH (N, NUNIT)
Specific: The specific interface name is UMACH.
FORTRAN 77 Interface
Single: CALL UMACH (N, NUNIT)
Description
Routine UMACH sets or retrieves the input, output, or error output device unit numbers. UMACH is set automatically so that the default FORTRAN unit numbers for standard input, standard output, and standard error are used. These unit numbers can be changed by inserting a call to UMACH at the beginning of the main program that calls MATH/LIBRARY routines. If these unit numbers are changed from the standard values, the user should insert an appropriate OPEN statement in the calling program.
Example
In the following example, a terminal error is issued from the MATH/LIBRARY AMACH function since the argument is invalid. With a call to UMACH, the error message will be written to a local file named “CHECKERR”.
USE AMACH_INT
USE UMACH_INT
INTEGER N, NUNIT
REAL X
! Set Parameter
N = 0
!
NUNIT = 9
CALL UMACH (-3, NUNIT)
OPEN (UNIT=9,FILE=’CHECKERR’)
X = AMACH(N)
END
Output
The output from this example, written to “CHECKERR” is:
*** TERMINAL ERROR 5 from AMACH. The argument must be between 1 and 8
*** inclusive. N = 0