You can set and export a number of environment variables for use with the AIX operating system. The following sections deal with the environment variables that have special significance to the XL Fortran compiler, application programs, or both.
You can set the environment variables from the Bourne shell, Korn shell, or the C shell. If you are not sure which shell is in use, a quick way to find out is to echo $0. This provides a different result in each shell:
$ sh $ echo $0 sh $ ksh $ echo $0 ksh $ csh % echo $0 No file for $0. % |
The Bourne shell path is /bin/sh, the Korn shell path is /bin/ksh, and the C shell path is /bin/csh.
To set the environment variables so that everyone on the system has access to them, set the variables in the file /etc/profile (for Bourne or Korn shell), or /etc/csh.login or /etc/csh.cshrc (for C shell). To set them for a specific user only, add the appropriate commands to the appropriate .profile or .cshrc file in the user's home directory. The variables are set the next time the user logs on.
For more information about setting environment variables, see the following information in the AIX Commands Reference:
The following example shows how to set environment variables from various shells.
From the Bourne or Korn shell:
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/prime/%N LANG=en_US TMPDIR=/home/joe/temp export LANG NLSPATH TMPDIR
From the C shell:
setenv LANG en_US setenv NLSPATH /usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/prime/%N setenv TMPDIR /home/joe/temp
To display the contents of an environment variable, enter the command echo $var_name.
Note: | Because the Korn shell is the default operating system shell, for the remainder of this book most examples of shell commands use ksh notation instead of repeating the syntax for all shells. |
Diagnostic messages and the listings from the compiler appear in the default language that was specified at installation of the operating system. If you want the messages and listings to appear in another language, you can set and export the following environment variables before executing the compiler:
For example, to specify the Japanese locale with the IBM_eucJP code page, use the following commands from the Bourne or Korn shell:
LANG=ja_JP NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/prime/%N export LANG NLSPATH
Substitute any valid national language code for ja_JP provided the associated message catalogs are installed.
These environment variables are initialized when the operating system is installed, and may be different from the ones that you want to use with the compiler.
Under AIX Version 4, the default setting for LANG may be different from what it was in AIX 3.2.5. For example, you may need to specify en_US instead of En_US.
Each category has an environment variable associated with it. If you want to change the national language for a specific category, but not for other categories, you can set and export the corresponding environment variable.
For example:
Notes:
Related Information: | Selecting the Language for Run-Time Messages.
See "National Language Support" in the AIX General Programming Concepts for more information about environment variables for other categories.
See Internationalization of AIX Software, A Programmer's Guide for more information about National Language Support environment variables and locale concepts. |
Under normal circumstances, you only need LIBPATH if libraries are located in different directories at run time from those that they are in at compile time. To use LIBPATH, set it at run time to the names of any directories that contain required user libraries, plus /usr/lib:
# Compile and link xlf90 -L/usr/lib/mydir1 -L/usr/lib/mydir2 -lmylib1 -lmylib2 test.f # When the libraries are in the same directories as at compile # time, the program finds them. a.out # If libmylib1.a and libmylib2.a are moved to /usr/lib/mydir3, # you must set the LIBPATH variable: export LIBPATH=/usr/lib/mydir3:/usr/lib a.out
When running the compiler, ensure that the library libxlf90.a is in /usr/lib or a directory named in the LIBPATH setting. Otherwise, you cannot run the compiler because it is dynamically linked with the libxlf90.a library.
When you compile a Fortran 90 program with the -qpdf compiler option, you can specify the directory where profiling information is stored by setting the PDFDIR environment variable to the name of the directory. The compiler creates the files to hold the profile information. XL Fortran updates the files when you run an application that is compiled with the -qpdf1 option.
Because problems can occur if the profiling information is stored in the wrong place or is updated by more than one application, you should follow these guidelines:
The XL Fortran compiler creates a number of temporary files for use during compilation. An XL Fortran application program creates a temporary file at run time for a file opened with STATUS='SCRATCH'. By default, these files are placed in the directory /tmp.
If you want to change the directory where these files are placed, perhaps because /tmp is not large enough to hold all the temporary files, set and export the TMPDIR environment variable before running the compiler or the application program.
The operating-system routine tempnam uses the value of TMPDIR for generating unique names for temporary files.
If you explicitly name a scratch file by using the XLFSCRATCH_unit method described below, the TMPDIR environment variable has no effect for that file.
To give a specific name to a scratch file, you can set the run-time option scratch_vars=yes, then set one or more environment variables with names of the form XLFSCRATCH_unit to file names to use when those units are opened as scratch files. See Naming Scratch Files for examples.
To give a specific name to an implicitly connected file or a file opened with no FILE= specifier, you can set the run-time option unit_vars=yes, then set one or more environment variables with names of the form XLFUNIT_unit to file names. See Naming Files That Are Connected with No Explicit Name for examples.