pxfrename

Date:

10-20-2011

NAME

PXFRENAME - Renames a file

SYNOPSIS

CHARACTER*n oldnm, newnm
INTEGER lenold, lennew, ierror
CALL PXFRENAME(oldnm, lenold, newnm, lennew, ierror)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

IEEE Std 1003.9-1992 standard interface for FORTRAN 77

DESCRIPTION

The PXFRENAME routine uses the rename(2)() function to change the name of a file.

All arguments must be of default kind unless documented otherwise. Default kind is KIND=4 for integer, real, complex, and logical arguments.

The following is a list of valid arguments for this routine:

oldnm

An input character variable or array element containing the current file name.

lenold

An input integer variable containing the length of oldnm in characters. If lenold is zero, all trailing blanks are removed before calling rename.

newnm

An input character variable or array element containing the new name of the file.

lennew

An input integer variable containing the length of newnm in characters. If lennew is zero, all trailing blanks are removed before calling rename.

ierror

An output integer variable that contains zero if the renaming of the file was successful or nonzero if the renaming of the file was not completed.

In addition to the errors returned by the rename(2) system call, PXFRENAME may return the following errors:

EINVAL

If lenold < 0 or lenold > LEN(old) or lennew < 0 or lennew > LEN(newf).

ENOMEM

If PXFRENAME is unable to obtain memory to copy oldnm or newnm.

EXAMPLES

program test
character*(12) filea, fileb
integer lenfila, lenfilb, ierror
filea = 'oldname'
fileb = 'newname'
lenfila = 0
lenfilb = 0
CALL PXFRENAME(filea,lenfila,fileb,lenfilb,ierror)
if (ierror.ne.0) then
    print *,'FAIL: error from pxfrename = ',ierror
else
    print *,'PASS: No error from pxfrename = '
endif
end

SEE ALSO

rename(2)