ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/renamefs.htm

202 lines
6.0 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>rename()--Rename File or Directory</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- file cleaned -->
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Change History: -->
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
<!-- 020618 EMIG: updated for NFS threadsafety, V5R3 -->
<!-- This file has undergone html cleanup June 2002 by JET -->
<!-- 020719 MFENLON: updated for QFileSvr.400 threadsafety, V5R3 -->
<!-- 031016 JTROUS Add cross links for rename files, no chg flag -->
<!--End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>rename()--Rename File or Directory</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;Qp0lstdi.h&gt;
int rename(const char <em>*old</em>, const char <em>*new</em>);
</pre>
&nbsp;&nbsp;Service Program Name: QP0LLIB1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Conditional; see <a href="#USAGE_NOTES">Usage Notes</a>.<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>rename()</strong> function can be defined to be either <strong>
Qp0lRenameUnlink()</strong> or <strong>Qp0lRenameKeep()</strong>, depending
upon the definitions of the _POSIX_SOURCE and _POSIX1_SOURCE macros in the
<strong>&lt;Qp0lstdi.h&gt;</strong> header file:</p>
<ul>
<li>When _POSIX_SOURCE or _POSIX1_SOURCE is defined, <strong>rename()</strong>
is defined to be <strong>Qp0lRenameUnlink()</strong>. Either <strong>
rename()</strong> or <strong>Qp0lRenameUnlink()</strong> can be used to rename
a file or directory with the semantics of <strong>
Qp0lRenameUnlink()</strong>.<br>
</li>
<li>When _POSIX_SOURCE and _POSIX1_SOURCE are <strong>not</strong> defined,
<strong>rename()</strong> is defined to be <strong>Qp0lRenameKeep()</strong>.
Either <strong>rename()</strong> or <strong>Qp0lRenameKeep()</strong> can be
used to rename a file or directory with the semantics of <strong>
Qp0lRenameKeep()</strong>.</li>
</ul>
<p>When the <strong>&lt;Qp0lstdi.h&gt;</strong> header file is <strong>
not</strong> included, <strong>rename()</strong> operates only on database
files in the QSYS.LIB or independent ASP QSYS.LIB file system, as it did before
the introduction of the integrated file system.</p>
<p>For details on the use of <strong>rename()</strong>,
see the <a href="renameun.htm">Qp0lRenameUnlink()</a> and
<a href="renamekp.htm">Qp0lRenameKeep()</a>
functions.</p>
<br>
<!-- Please NOTE: DO NOT DELETE THIS SECTION if this API has no authorities and locks. -->
<!-- Instead, use the commented out coding below to indicate NONE. -->
<h3>Authorities and Locks</h3>
<!-- Use this if there are no authorities and locks. -->
<p>None.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>old</em></strong></dt>
<dd>(Input) A pointer to the null-terminated path name of the file to be
renamed.
<p>This parameter is assumed to be represented in the CCSID (coded character
set identifier) currently in effect for the job. If the CCSID of the job is
65535, this parameter is assumed to be represented in the default CCSID of the
job.</p>
<br>
</dd>
<dt><strong><em>new</em></strong></dt>
<dd>(Input) A pointer to the null-terminated path name of the new name of the
file.
<p>This parameter is assumed to be represented in the CCSID currently in effect
for the job. If the CCSID of the job is 65535, this parameter is assumed to be
represented in the default CCSID of the job.</p>
<p>The new file name is assumed to be represented in the language and country
or region currently in effect for the process.</p>
</dd>
</dl>
<br>
<h3><a name="USAGE_NOTES">Usage Notes</a></h3>
<ol type="1">
<li>This function will fail with error code [ENOTSAFE] when all the following
conditions are true:
<ul>
<li>Where multiple threads exist in the job.<br>
</li>
<li>The object on which this function is operating resides in a file system
that is not threadsafe. Only the following file systems are threadsafe for this
function:
<ul>
<li>"Root" (/)</li>
<li>QOpenSys</li>
<li>User-defined</li>
<li>QNTC</li>
<li>QSYS.LIB</li>
<li>Independent ASP QSYS.LIB</li>
<li>QOPT</li>
<li>Network File System</li>
<li>QFileSvr.400</li>
</ul>
</li>
</ul>
</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>stdio.h</strong>&gt; file (see <a href="unix13.htm">Header
Files for UNIX-Type Functions</a>)<br>
</li>
<li>The &lt;<strong>Qp0lstdi.h</strong>&gt; file (see <a href="unix13.htm">
Header Files for UNIX-Type Functions</a>)<br>
</li>
<li><a href="pathconf.htm">pathconf()</a>--Get Configurable Path Name
Variables<br>
</li>
<li><a href="renamekp.htm">Qp0lRenameKeep()</a>--Rename File or Directory, Keep
"new" If It Exists<br>
</li>
<li><a href="renameun.htm">Qp0lRenameUnlink()</a>--Rename File or Directory,
Unlink "new" If It Exists</li>
</ul>
<br>
<hr>
API introduced: V3R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>