<< >> Title Contents Index Home Help

B VAX System Subroutines


This appendix discusses the VAX/VMS system subroutines and built-in functions supported by pgf77.

Built-in Functions

The built-in functions perform inter-language utilities for argument passing and location calculations. The following built-in functions are available:


%LOC(arg)

Compute the address of the argument arg.


%REF(a)

Pass the argument a by reference.


%VAL(a)

Pass the argument as a 32-bit immediate value (64-bit if a is double precision.) A value of 64-bits is also possible if supported for integer and logical values.

VAX/VMS System Subroutines


DATE

The DATE subroutine returns a nine-byte string containing the ASCII representation of the current date. It has the form:

CALL DATE(buf)
where buf is a nine-byte variable, array, array element, or character substring. The date is returned as a nine-byte ASCII character string of the form:
	dd-mmm-yy
Where:
dd
Is the two-digit day of the month
mmm
Is the three-character abbreviation of the month
yy
Is the last two digits of the year

EXIT

The EXIT subroutine causes program termination, closes all open files, and returns control to the operating system. It has the form:

CALL EXIT[(exit_status)]
where:
exit_status
is an optional integer argument used to specify the image exit value.

GETARG

SUBROUTINE GETARG(N, ARG)
INTEGER*4 N
CHARACTER* (*) ARG
The GETARG subroutine returns the Nth command line argument in character variable ARG. For N equal to zero, the name of the program is returned.

IARGC

INTEGER*4 	FUNCTION IARGC()

The IARGC subroutine returns the number of command line arguments following the program name.

IDATE

The IDATE subroutine returns three integer values representing the current month, day, and year. It has the form:

CALL IDATE(IMONTH, IDAY, IYEAR)
If the current date were October 9, 1992, the values of the integer variables upon return would be:
IMONTH = 10
IDAY = 9
IYEAR = 92

MVBITS

The MVBITS subroutine transfers a bit field from one storage location (source) to a field in a second storage location (destination). MVBITS transfers a3 bits from positions a2 through (a2 + a3 - 1) of the source, src, to positions a5 through (a5 + a3 - 1) of the destination, dest. Other bits of the destination location remain unchanged. The values of (a2 + a3) and (a5 + a3) must be less than or equal to 32 (if the source or destination is INTEGER*8, less than or equal to 64). It has the form:

	CALL MVBITS(src, a2, a3, dest, a5)
Where:
src
is an integer variable or array element that represents the source location.
a2
is an integer expression that identifies the first position in the field transferred from src.
a3
is an integer expression that identifies the length of the field transferred from src.
dest
is an integer variable or array element that represents the destination location.
a5
is an integer expression that identifies the starting position within a4, for the bits being transferred.

RAN

The RAN subroutine returns the next number from a sequence of pseudo-random numbers of uniform distribution over the range 0 to 1. The result is a floating point number that is uniformly distributed in the range between 0.0 and 1.0 exclusive. It has the form:

y = RAN(i)
where y is set equal to the value associated by the function with the seed argument i. The argument i must be an INTEGER*4 variable or INTEGER*4 array element.

The argument i should initially be set to a large, odd integer value. The RAN function stores a value in the argument that it later uses to calculate the next random number.

There are no restrictions on the seed, although it should be initialized with different values on separate runs in order to obtain different random numbers. The seed is updated automatically, and RAN uses the following algorithm to update the seed passed as the parameter:

SEED = 6969 * SEED + 1 ! MOD 2**32
The value of SEED is a 32-bit number whose high-order 24 bits are converted to floating point and returned as the result.

If the command-line option to treat all REAL declarations as DOUBLE PRECISION declarations is in effect, RAN returns a DOUBLE PRECISION value.


SECNDS

The SECNDS subroutine provides system time of day, or elapsed time, as a floating point value in seconds. It has the form:

y = SECNDS(x)
where (REAL or DOUBLE PRECISION) y is set equal to the time in seconds since midnight, minus the user supplied value of the (REAL or DOUBLE PRECISION) x. Elapsed time computations can be performed with the following sequence of calls.
X = SECNDS(0.0)
...
... ! Code to be timed
...
DELTA = SECNDS(X)
The accuracy of this call is the same as the resolution of the system clock.

TIME

The TIME subroutine returns the current system time as an ASCII string. It has the form:

CALL TIME(buf)
where buf is an eight-byte variable, array, array element, or character substring. The TIME call returns the time as an eight-byte ASCII character string of the form:
hh:mm:ss
For example:
16:45:23
Note that a 24-hour clock is used.


<< >> Title Contents Index Home Help