B.3.2.3 Installing gawk on OpenVMS

To use gawk, all you need is a “foreign” command, which is a DCL symbol whose value begins with a dollar sign. For example:

$ GAWK :== $disk1:[gnubin]gawk

Substitute the actual location of gawk.exe for ‘$disk1:[gnubin]’. The symbol should be placed in the login.com of any user who wants to run gawk, so that it is defined every time the user logs on. Alternatively, the symbol may be placed in the system-wide sylogin.com procedure, which allows all users to run gawk.

If your gawk was installed by a PCSI kit into the GNV$GNU: directory tree, the program will be known as GNV$GNU:[bin]gnv$gawk.exe and the help file will be GNV$GNU:[vms_help]gawk.hlp.

The PCSI kit also installs a GNV$GNU:[vms_bin]gawk_verb.cld file that can be used to add gawk and awk as DCL commands.

For just the current process you can use:

$ set command gnv$gnu:[vms_bin]gawk_verb.cld

Or the system manager can use GNV$GNU:[vms_bin]gawk_verb.cld to add the gawk and awk commands to the system-wide ‘DCLTABLES’.

The DCL syntax is documented in the gawk.hlp file.

Optionally, the gawk.hlp entry can be loaded into an OpenVMS help library:

$ LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp

(You may want to substitute a site-specific help library rather than the standard OpenVMS library ‘HELPLIB’.) After loading the help text, the command:

$ HELP GAWK

provides information about both the gawk implementation and the awk programming language.

The logical name ‘AWK_LIBRARY’ can designate a default location for awk program files. For the -f option, if the specified file name has no device or directory path information in it, gawk looks in the current directory first, then in the directory specified by the translation of ‘AWK_LIBRARY’ if the file is not found. If, after searching in both directories, the file still is not found, gawk appends the suffix ‘.awk’ to the file name and retries the file search. If ‘AWK_LIBRARY’ has no definition, a default value of ‘SYS$LIBRARY:’ is used for it.