Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

length of array for IOMSG clause

Mike_Rezny
Novice
1,351 Views
Hi,
I have done a search for IOMSG in the Intel Fortram manual 11.1 but there does not appear to be much information available other than stating it is a Fortran 2003 feature included in this release.

There is no mention of theIOMSG specifier in the File Operation I/O Statements section.
Is this something that will be addressed in later versions of the manual?

How does one determine the correct size of the character array passed as the IOMSG parameter?

CHARACTER() :: msg
OPEN(......., IOMSG=msg)

Isthe minimum length defined in the Fortran 2003 Standard or is it Compiler dependent?
Is there a way to query, at runtime,what the minimum length is?

regards
Mike
1 Solution
Steven_L_Intel1
Employee
1,351 Views
The Fortran standard is silent on the matter of the length, and there is no way to query a "minimum length". In our implementation, a length of 100 should suffice. Yes, we plan on documenting the F2003 features in a future version.

View solution in original post

5 Replies
Steven_L_Intel1
Employee
1,352 Views
The Fortran standard is silent on the matter of the length, and there is no way to query a "minimum length". In our implementation, a length of 100 should suffice. Yes, we plan on documenting the F2003 features in a future version.
jimdempseyatthecove
Honored Contributor III
1,351 Views

If the IOMSG is a system message text string then the O/S may have a maximum message string size. As to what to use, this may depend on the O/S. 100 might be too small _MAX_PATH (260) might be safer. One buffer of _MAX_ENV (32767) might be safest.

These are Windoz values, alter for Linux/Mac equivilents.

Jim
Steven_L_Intel1
Employee
1,351 Views
I believe that it is a string from the Intel Fortran message catalog and won't include system error text.
0 Kudos
Mike_Rezny
Novice
1,351 Views

If the IOMSG is a system message text string then the O/S may have a maximum message string size. As to what to use, this may depend on the O/S. 100 might be too small _MAX_PATH (260) might be safer. One buffer of _MAX_ENV (32767) might be safest.

These are Windoz values, alter for Linux/Mac equivilents.

Jim
Hi Jim,
Thanks for this information.
I did a search of the Fortran manual and could find no reference to these two values.

I tried printing out _MAX_PATH, _MAX_ENV, MAX_PATH, MAX_ENV in a small Fortran program (11.0.074)
but the compiler claims they are undeclared. Do I need to use a module or something else to get these values?

I am using a Linux system. Does this make a difference?

regards
Mike
0 Kudos
Steven_L_Intel1
Employee
1,351 Views
Those are all Windows constants defined in Windows-only modules. There are no equivalent constants defined for Fortran on Linux. Just pick a number.
0 Kudos
Reply