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

445 lines
18 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>Exit Program for Copy Stream File (QHFCPYSF) API</title>
<!-- 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 Edited November 2001 -->
<!--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>Exit Program for Copy Stream File (QHFCPYSF) API</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Required Parameter Group:<br>
<!-- iddvc RMBR -->
<br>
<table width="100%">
<tr>
<td align="center" valign="top" width="10%">1</td>
<td align="left" valign="top" width="50%">Operation (CPYSF)</td>
<td align="left" valign="top" width="20%">Input</td>
<td align="left" valign="top" width="20%">Char(5)</td>
</tr>
<tr>
<td align="center" valign="top">2</td>
<td align="left" valign="top">File system job handle</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(16)</td>
</tr>
<tr>
<td align="center" valign="top">3</td>
<td align="left" valign="top">Reserved</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(20)</td>
</tr>
<tr>
<td align="center" valign="top">4</td>
<td align="left" valign="top">Source file path name</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(*)</td>
</tr>
<tr>
<td align="center" valign="top">5</td>
<td align="left" valign="top">Source file path name length</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">6</td>
<td align="left" valign="top">Copy information</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(6)</td>
</tr>
<tr>
<td align="center" valign="top">7</td>
<td align="left" valign="top">Target file path name</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(*)</td>
</tr>
<tr>
<td align="center" valign="top">8</td>
<td align="left" valign="top">Target file path name length</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">9</td>
<td align="left" valign="top">File system names</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Char(20)</td>
</tr>
</table>
<br>
</div>
<p>Before applications can use the Copy Stream File (QHFCPYSF) API with your file system, you must:</p>
<ol>
<li>Write an exit program that performs the copy stream file operation on behalf of the API. For a detailed description of the API and its calling parameters, see <a href="qhfcpysf.htm">Copy Stream File (QHFCPYSF) API</a>.<br><br></li>
<li>Give the exit program's name when you register the file system with the Register File System (QHFRGFS) API. In the registration-information parameter of the QHFRGFS API, indicate whether this exit program can be used for copy operations involving two different file systems.</li>
</ol>
<p>After that, when an application calls the QHFCPYSF API, the API calls your exit program and passes it the parameters specified by the application. Your exit program performs the work and returns any data to the API. The API passes the data back to the calling application.</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>Required Parameter Group</h3>
<p>The API passes this information to your exit program:</p>
<dl>
<dt><strong>Operation (CPYSF)</strong></dt>
<dd>INPUT; CHAR(5)
<p>The abbreviation for the operation being performed (CPYSF).</p></dd>
<dt><strong>File system job handle</strong></dt>
<dd>INPUT; CHAR(16)
<p>The work area or job identifier for use by the file system.</p></dd>
<dt><strong>Reserved</strong></dt>
<dd>INPUT; CHAR(20)
<p>Reserved for future use. This parameter is set to blanks.</p></dd>
</dl>
<p>Except as noted, the following parameters are the same as the parameters for the API.</p>
<dl>
<dt><strong>Source file path name</strong>
<dd>INPUT; CHAR(*)
<p>The API removes the file system name before passing the path name to the exit program.</p></dd>
<dt><strong>Source file path name length</strong></dt>
<dd>INPUT; BINARY(4)<br><br></dd>
<dt><strong>Copy information</strong></dt>
<dd>INPUT; CHAR(6)<br><br></dd>
<dt><strong>Target file path name</strong></dt>
<dd>INPUT; CHAR(*)
<p>The API removes the file system name before passing the path name to the exit program.</p></dd>
<dt><strong>Target file path name length</strong></dt>
<dd>INPUT; BINARY(4)<br><br></dd>
<dt><strong>File system names</strong></dt>
<dd>INPUT; CHAR(20)
<p>This is not an API parameter. The API derives this information from its source and target file path name parameters. The first 10 characters contain the name of the source file system, and the second 10 characters contain the name of the target file system.</p></dd>
</dl>
<br>
<h3><a name="HDRAPICC">API Functions</a></h3>
<p> The QHFCPYSF API performs the standard functions described in <a href="hfs3d.htm#HDRSTDAPI">Standard HFS API Functions</a>.</p>
<p>When the source and target file systems are different, the API performs additional functions so that the file is copied by the most efficient means available. The following diagram outlines the processing steps. The steps are the same for copy and move operations. They are described in detail after the diagram.</p>
<br>
<img src="RBAFX505.gif" alt="copy stream file exit program">
<br>
<p>After determining that the file systems differ, the API tries to perform the copy operation in several different ways. If a method fails, the API proceeds to the next method. The possible methods are to call the following exit programs in the sequence listed:</p>
<ol>
<li>The source file system's Copy Stream File exit program<br><br></li>
<li>The target file system's Copy Stream File exit program<br><br></li>
<li>A series of other exit programs, such as those for opening, reading from, and writing to stream files, in the source and target file systems</li>
</ol>
<p>The following paragraphs describe each method in detail.</p>
<ol>
<li><strong>The source file system's Copy Stream File exit program:</strong>
<p>First, the API checks the information provided when the source file system was registered with the Register File System (QHFRGFS) API. The copy or move indicator is character 2 of the registration-information parameter described in the <a href="qhfrgfs.htm">Register File System (QHFRGFS) API</a>.</p>
<p>If the value of the source file system's copy or move indicator is 0 for no (indicating that this file system has no cross-file-system capability), the API proceeds to try the target file system.</p>
<p>If the value of the source file system's copy or move indicator is 1 for yes (indicating that this file system has some cross-file-system capability), the API calls the file system's Copy Stream File exit program.</p>
<p>If the exit program encounters an error in communicating with the source file system--for example, the exit program can work with some other file systems but not with this one--it returns message CPF1F88 to the API, which proceeds to the target file system.</p>
<p>If the exit program completes the copy or encounters any other type of error--for example, the exit program cannot find the file to be copied--it returns control to the API. The API resends any errors received from the exit program to the application and then returns control to the application.</p></li>
<li><strong>The target file system's Copy Stream File exit program:</strong>
<p>The API follows the same procedure as for the source file system, checking the copy or move indicator and then trying the target file system's Copy Stream File exit program. If the copy or move indicator is 0 for no or if the exit program returns message CPF1F88, the API proceeds to try the other exit programs.</p></li>
<li><strong>A series of other exit programs in the source and target file systems:</strong>
<p>If the source and target file systems' Copy Stream File exit programs have no cross-file-system capability at all, or if they have no such capability with respect to each other, the API might be able to perform a less efficient form of copy operation. If the following exit programs exist in the source and target file systems, the API tries to perform the copy operation. If any of these exit programs do not exist, the API returns message CPF1F82 and returns control to the application without performing the copy operation.</p>
<p>The required exit programs in the source file system are:</p>
<ul>
<li>Open Stream File (for the QHFOPNSF API)<br><br></li>
<li>Read from Stream File (for the QHFRDSF API)<br><br></li>
<li>Close Stream File (for the QHFCLOSF API)<br><br></li>
<li>Retrieve Stream File Attributes (for the QHFRTVAT API)<br><br></li>
<li>Delete Stream File (for the QHFDLTSF API). This exit program is required for both copy and move operations. However, it is used only during move operations.</li>
</ul>
<p>The required exit programs in the target file system are:</p>
<ul>
<li>Open Stream File (for the QHFOPNSF API)<br><br></li>
<li>Write to Stream File (for the QHFWRTSF API)<br><br></li>
<li>Change File Pointer (for the QHFCHGFP API). This exit program is required for both copy and move operations. However, it is used only during copy operations in which the source file is being added to an existing target file.<br><br></li>
<li>Close Stream File (for the QHFCLOSF API)<br><br></li>
<li>Change Stream File Attributes (for the QHFCHGAT API)<br><br></li>
<li>Delete Stream File (for the QHFDLTSF API)</li>
</ul>
<p>The API uses the exit programs to perform their ordinary functions:</p>
<ul>
<li>The source file system's Open Stream File exit program opens the source file, and the target file system's Open Stream File exit program opens the target file.<br><br></li>
<li>The source file system's Read from Stream File exit program and the target file system's Write to Stream File exit program repeatedly read from the source file and write to the target file until all the data has been copied from one to the other.<br><br></li>
<li>The source file system's Retrieve Stream File Attributes exit program retrieves the attributes stored with the source file, and the target file system's Change Stream File Attributes exit program writes the attributes to the target file.<br><br></li>
<li>The source and target file systems' Close Stream File exit programs close the source and target files.<br><br></li>
<li>The source file system's Delete Stream File exit program deletes the source file after a successful move operation.
<p>The target file system's Delete Stream File exit program is used during unsuccessful copy and move operations. If errors cause the failure of the operation as a whole, the exit program deletes any incomplete target files created during the operation. Target files that existed before the operation began are not deleted but might be partly changed.</p></li>
</ul>
</li>
</ol>
<br>
<h3><a name="HDREXICC">Exit Program Requirements</a></h3>
<p>You must create an exit program that performs the standard functions described in <a href="hfs3d.htm#HDRSTDFS">Standard HFS Exit Program Requirements</a> and these additional functions:</p>
<ul>
<li>If the source and target paths to the files are the same, verifies that the source and target file names are different.<br><br></li>
<li>If the source and target file systems are different, takes these actions:
<ul>
<li>Determines whether it is the source or the target file system by examining the exit program's file-system-names parameter.<br><br></li>
<li>Performs the copy operation or returns control to the application or API as described in <a href="#HDRAPICC">API Functions</a>.
<p>When the exit program has some cross-file-system capability but cannot complete this specific copy operation, it should return message CPF1F88 to the API. This tells the API that it might still be possible to perform the copy operation by other means. If unavoidable errors occur--for example, if the file being copied does not exist--then the exit program should return those errors to the API.</p></li>
</ul>
<p>Whether or not the QHFCPYSF API calls this exit program for cross-file-system operations depends on information provided when this file system was registered. If the second character of the registration-information parameter of the Register File System (QHFRGFS) API has a value of 1 (yes), the QHFCPYSF API calls this exit program. If that character has a value of 0 (no), the QHFCPYSF API does not call this exit program for cross-file-system operations; instead, the API bypasses this exit program and proceeds to try the next available method of copying files.</p></li>
<li>If the operation is replacing or adding a copy to a file, verifies that the target file exists.<br><br></li>
<li>Ensures that the user has the required authority to both the source and target paths and files.<br><br></li>
<li>Ensures that the user has read access to the source file and write access to the target file.</li>
</ul>
<br>
<h3>Error Messages for Exit Program Use</h3>
<p>This section lists the messages that the exit program can return to the API.</p>
<table cellpadding="3">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td align="left" valign="top">CPF1F01 E</td>
<td valign="top">Directory name not valid.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F02 E</td>
<td valign="top">Directory not found.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F06 E</td>
<td valign="top">Directory in use.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F07 E</td>
<td valign="top">Authority not sufficient to access directory.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F08 E</td>
<td valign="top">Damaged directory.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F21 E</td>
<td valign="top">File name not valid.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F22 E</td>
<td valign="top">File not found.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F23 E</td>
<td valign="top">New file name same as old file name.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F24 E</td>
<td valign="top">File name already exists.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F26 E</td>
<td valign="top">File in use.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F27 E</td>
<td valign="top">Authority not sufficient to access file.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F28 E</td>
<td valign="top">Damaged file.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F29 E</td>
<td valign="top">Use of reserved file name not allowed.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F41 E</td>
<td valign="top">Severe error occurred while addressing parameter list.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F48 E</td>
<td valign="top">Path name not valid.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F51 E</td>
<td valign="top">Copy information value not valid.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F61 E</td>
<td valign="top">No free space available on media.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F62 E</td>
<td valign="top"> Requested function failed.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F63 E</td>
<td valign="top">Media is write protected.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F66 E</td>
<td valign="top">Storage needed exceeds maximum limit for user profile &amp;1.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F71 E</td>
<td valign="top">Exception specific to file system occurred.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F73 E</td>
<td valign="top">Not authorized to use command.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F74 E</td>
<td valign="top">Not authorized to object.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F75 E</td>
<td valign="top">Error occurred during start-job-session function.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F77 E</td>
<td valign="top">Severe parameter error occurred on call to file system.</td>
</tr>
<tr>
<td align="left" valign="top">CPF1F88 E</td>
<td valign="top">Unable to complete copy or move operation.</td>
</tr>
</table>
<p><strong>Note:</strong> You can use message CPF1F88 only when trying to perform cross-file-system copy operations. If you use it when copying files within a single file system, an <samp>Internal file system error</samp> message is returned to the application. You can use the exit program's file-system-names parameter to determine whether the move is across file systems.</p>
<p>Because this message does not always indicate an error, the application calling the QHFCPYSF API does not receive it. It is used only to communicate between the file system's exit program and the API.</p>
<hr>
Exit Program Introduced: V2R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a
href="hfs1.htm">Hierarchical File System APIs</a> |
<a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>