J3/04-107 Date: 7 Dec 03 To: J3 From: Dan Nagle Subject: Obtain a logical unit for opening Logical Unit numbers are processor dependent, there is no guaranteed way to obtain one. Rules of thumb, such as "use a number greater than ten" are only somewhat portable. This proposal is for an intrinsic procedure to return a logical unit number which may be opened. Number: Title: GET_LOGICAL_UNIT Submitted By: J3 Status: For Consideration References: Basic Functionality: Add an intrinsic procedure to ISO_FORTRAN_ENV to return a logical unit number which may be opened. Rationale: Logical unit numbers are processor-dependent, some method of getting one should be supported. Some programs (for example, multithreaded programs) may want units to be distributed according to a rule (for example, 1000 time thread number plus offset). Thus, some flexibility should be part of this intrinsic. Estimated Impact: The estimated impact is low, the processor can always return an error code if it gets an invalid request. Otherwise, the processor knows which numbers it supports as valid units. Detailed Specification: Add to ISO_FORTRAN_ENV the following procedure: GET_LOGICAL_UNIT( UNITS=, [ NOTLIST=, ] [ MINUNIT=, ] [ MAXUNIT=, ] [ IOSTAT=, ] [ IOMSG= ] ) UNITS= an integer rank-1 array whose size is the number of unit numbers requested on this call. Each element of this array is a unit number which may be opened (as of the time of the call). INPUT_UNIT, OUTPUT_UNIT and ERROR_UNIT will never appear as they are already open. This is an intent( out) argument NOTLIST= is an integer rank-1 array forming a list of numbers which should be excluded from consideration as unit numbers (that is, a number on the not list will not be returned in the units array). This is an intent( in) argument MINUNIT= a scalar integer giving the smallest number desired. This is an intent( in) argument MAXUNIT= a scalar integer giving the greatest number desired. This is an intent( in) argument IOSTAT= is an integer status variable where zero indicates success and greater than zero indicates an error has occured. This is an intent( out) argument IOMSG= is the vendor's cheerful error message. This is an intent( out) argument Example: integer, dimension( 5) :: myunits call get_logical_unit( units= myunits, minunit= 10) requests 5 unit numbers not less than 10. History: