Portability Procedures: table

Note: Programs that use these procedures must access the portability library with USE DFPORT. Square brackets [...] denote optional arguments.

Name Procedure Type Description Argument/Function Type
ABORT Subroutine CALL ABORT([str]). Flushes and closes all I/O buffers and terminates execution with the optional abort message in string. str: CHARACTER*(*)
ACCESS Function ACCESS(nm, md). Checks the file name specified by nm for accessibility to the caller in md mode. nm: CHARACTER*(*)

md: CHARACTER*(*)

result: INTEGER(4)

ALARM Function ALARM(time, proc). Executes the subroutine proc after time seconds elapse. time: INTEGER(4)

proc: External procedure

result: INTEGER(4)

BESJ0, BESJ1,
BESJN, BESY0,
BESY1, BESYN
Functions Bessel functions of the first and second kinds and integer orders. BESJ0(x), BESJ1(x), BESY0(x), BESY1(x) take argument x. BESJN(n, x) and BESYN(n, x) take arguments integer order n and value x. n: INTEGER(4)

x: REAL(4)

result: REAL(4)

BIC, BIS, BIT Subroutines
and
Function
Bit clear and set subroutines, and bit test function.

CALL BIC(bitnum, target) clears a bit.

CALL BIS(bitnum, target) sets a bit.

BIT(bitnum, source) tests a bit.

bitnum: INTEGER(4)

target: INTEGER(4)

source: INTEGER(4)

return from BIT: Logical

CHDIR Function CHDIR(dir_name). Changes the default directory to dir_name. dir_name: CHARACTER*(*)

result: INTEGER(4)

CHMOD Function CHMOD(nm, md). Changes the md attributes of a file name specified by nm. nm: CHARACTER*(*)

md: CHARACTER*(*)

result: INTEGER(4)

CLOCK Function CLOCK( ). Returns the time in HH:MM:SS format. result:
CHARACTER(len=8)
CTIME Function CTIME(stime). Converts system time to a 24-character ASCII string. stime: INTEGER(4)

result:
CHARACTER(len=24)

DATE Subroutine
or Function
CALL DATE(str) or
DATE( ). Returns the date as an ASCII string.
str: CHARACTER*(*)

return from DATE:
CHARACTER(len=8)

DBESJ0, DBESJ1,
DBESJN, DBESY0,
DBESY1, DBESYN
Functions REAL(8) Bessel functions of the first and second kinds and integer orders. DBESJ0(x), DBESJ1(x), DBESY0(x), DBESY1(x) take argument x. DBESJN(n, x) and DBESYN(n, x) take arguments integer order n and value x. n: INTEGER(4)

x: REAL(8)

result: REAL(8)

DRAND,
DRANDM
Functions DRAND(iflag) and DRANDM(iflag). Return random numbers between 0.0 and 1.0, chosen according to the value of iflag. iflag: INTEGER(4)

result: REAL(8)

DTIME1 Function DTIME(tarray). Returns the elapsed time since the last call to DTIME or the program start. tarray(2): REAL(4)

result: REAL(4)

ETIME1 Function ETIME(tarray). Returns the elapsed CPU time since the last call to ETIME or the program start. tarray(2): REAL(4)

result: REAL(4)

FDATE Subroutine
or Function
CALL FDATE(str) or
FDATE( ). Returns the date and time as an ASCII string.
str: CHARACTER*(*)

return from FDATE:
CHARACTER(len=24)

FGETC Function FGETC(lunit, char). Reads the next available character from lunit and places it in char. lunit: INTEGER(4)

char:CHARACTER(len=1)

result: INTEGER(4)

FLUSH Subroutine CALL FLUSH(lunit). Causes the contents of the lunit buffer to be flushed to the associated file. lunit: INTEGER(4)
FPUTC Function FPUTC(lunit, char). Writes a character char to the file associated with lunit, bypassing normal Fortran I/O. lunit: INTEGER(4)

char:CHARACTER(len=1)

result: INTEGER(4)

FSEEK Subroutine FSEEK(lunit, offset, from). Repositions a file on a logical unit to offset bytes relative to position from. lunit: INTEGER(4)

offset: INTEGER(4)

from: INTEGER(4)

result: INTEGER(4)

FSTAT Function FSTAT(lunit, statb). Returns information about lunit in the array statb. lunit: INTEGER(4)

statb(12): INTEGER(4)

result: INTEGER(4)

FTELL Function FTELL(lunit). Returns the current position of the file associated with lunit as an offset in bytes from the beginning of the file. lunit: INTEGER(4)

result: INTEGER(4)

GERROR Subroutine CALL GERROR(str). Fills string with a message for the last detected IERRNO error. str: CHARACTER*(*)
GETC Function GETC(char). Gets the next available character from logical unit 5, usually connected to the console, and places it in char, bypassing normal Fortran I/O. char:CHARACTER(len=1)

result: INTEGER(4)

GETCWD Function GETCWD(dirname). Places the current working directory path in dirname. dirname: CHARACTER*(*)

result: INTEGER(4)

GETENV Function CALL GETENV(ename, eval). Searches the environment list for a string of the form ename=eval and returns the value found in eval or blanks. ename:
CHARACTER*(*)

eval:
CHARACTER*(*)

GETGID Function GETGID( ). Included for portability. Always returns 1. result: INTEGER(4) equal to 1
GETLOG Subroutine CALL GETLOG(nm). Returns the user's login name or blanks. nm: CHARACTER*(*)
GETPID Function GETPID( ). Returns the process ID number of the current process. result: INTEGER(4)
GETUID Function GETUID( ). Included for portability. Always returns 1. result: INTEGER(4) equal to 1
GMTIME Subroutine CALL GMTIME(stime, tarray). Separates the time returned by TIME( ) in stime into GMT date and time and stores in tarray. stime: INTEGER(4)

tarray(9): INTEGER(4)

HOSTNAM Function HOSTNAM(nm). Puts the name of the current host into nm. nm: CHARACTER*(*)

result: INTEGER(4)

IARGC Function IARGC( ). Returns the index of the last command-line argument. result: INTEGER(4)
IDATE Subroutine CALL IDATE(iarray) or
CALL IDATE(month, day, year). Returns the day, month and year in iarray or the parameters month, day, and year.
iarray(3): INTEGER(4)

month: INTEGER(4)

day: INTEGER(4)

year: INTEGER(4)

IERRNO Function IERRNO( ). Returns the last IERRNO error code. result: INTEGER(4)
IRAND,
IRANDM
Functions IRAND(iflag) and IRANDM(iflag). Return integer random numbers between 0 and (2**31) -1, chosen according to the value of iflag. iflag: INTEGER(4)

result: INTEGER(4)

ITIME Subroutine CALL ITIME(iarray). Returns the current time in iarray. iarray(3): INTEGER(4)
JDATE Function JDATE( ). Return the Julian date in the form YYDDD. result:
CHARACTER(len=8)
KILL Function KILL(pid, signum). Sends a signal designated by signum (defined in SIGNAL) to the calling process designated by pid (returned by GETPID). pid: INTEGER(4)

signum: INTEGER(4)

result: INTEGER(4)

LNBLNK Function LNBLNK(str). Returns the index of the last nonblank character in str. str: CHARACTER*(*)

result: INTEGER(4)

LONG Function LONG(int2). Returns an INTEGER(2) argument as an INTEGER(4). int2: INTEGER(2)

result: INTEGER(4)

LSTAT Function LSTAT(nm, statb). Returns information about the file named nm in the array statb. nm: CHARACTER*(*)

statb(12): INTEGER(4)

result: INTEGER(4)

LTIME Subroutine CALL LTIME(stime, tarray). Separates the time returned by TIME( ) in stime into the date and time for the local time zone and stores in tarray. stime: INTEGER(4)

tarray(9): INTEGER(4)

PERROR Subroutine CALL PERROR(str). Sends an error message to the standard error stream, preceded by str with a message for the last detected IERRNO error. str: CHARACTER*(*)
PUTC Function PUTC(char).Writes a character char to logical unit 6. char:CHARACTER(len=1)

result: INTEGER(4)

QSORT Subroutine CALL QSORT(array, len, isize, compar). Sorts len elements of array each of length size according to the sorting order in a user-supplied function compar. array: any type

len: INTEGER(4)

isize: INTEGER(4)

compar: External INTEGER(2) function

RAN Function RAN(iseed). Returns a uniformly distributed random number between 0.0 and 1.0. seed: INTEGER(4)

result: REAL(4)

RAND,
RANDOM
Functions RAND(iflag) and RANDOM(iflag). Return random numbers between 0.0 and 1.0, chosen according to the value of iflag. iflag: INTEGER(4)

result: REAL(4)

RENAME Function RENAME(from, to). Renames a file from from to to. If to exists it is removed first. from:
CHARACTER*(*)

to: CHARACTER*(*)

result: INTEGER(4)

RINDEX Function RINDEX(str, substr). Returns the index of the last occurrence of substr in str, or 0. str: CHARACTER*(*)

substr:
CHARACTER*(*)

result: INTEGER(4)

RTC Function RTC( ). Returns the number of seconds since 00:00:00 Greenwich mean time, January 1, 1970. result: REAL(8)
SECNDS Function SECNDS(offset). Returns the number of seconds that have elapsed since midnight, minus offset. offset: REAL(4)

result: REAL(4)

SHORT Function SHORT(int4). Returns an INTEGER(4) argument as an INTEGER(2). int4: INTEGER(4)

result: INTEGER(2)

SIGNAL Function SIGNAL(signum, proc, flag). Changes the action taken for the signal designated by signum to the external signal processing procedure proc. Implementation of proc is controlled by flag. signum: INTEGER(4)

proc: External function

flag: INTEGER(4)

result: INTEGER(4)

SLEEP Subroutine CALL SLEEP(itime). Suspends the calling process for itime seconds. itime: INTEGER(4)
STAT Function STAT(nm, statb). Returns information about the file named nm in the array statb. nm: CHARACTER*(*)

statb(12): INTEGER(4)

result: INTEGER(4)

SYSTEM Function SYSTEM(str). Causes str to be given to your shell as input as if str had been typed as a command. str: CHARACTER*(*)

result: INTEGER(4)

TIME Subroutine
or Function
CALL TIME(str) or
TIME( ). As a subroutine, fills str with the current time formatted as HH:MM:SS. As a function, returns elapsed seconds since 00:00:00 Greenwich mean time, January 1, 1970.
str:CHARACTER(len=8)

result: INTEGER(4)

TIMEF Function TIMEF( ). Returns the number of seconds since the first time it was called. The first time called, TIMEF returns 0.0D0. result: REAL(8)
UNLINK Function UNLINK(nm). Removes the file specified by path nm. nm: CHARACTER*(*)

result: INTEGER(4)

1 WNT only

Warning: The two-digit year return value of DATE, IDATE, and JDATE may cause problems with the year 2000. Use DATE_AND_TIME instead.

For more information on using these procedures, see Portability Library in the Programmer's Guide.