117 lines
8.1 KiB
HTML
117 lines
8.1 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2005" />
|
|
<meta name="DC.rights.owner" content="(C) Copyright IBM Corporation 2005" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="concept" />
|
|
<meta name="DC.Title" content="Monitoring for zero records in the from-file" />
|
|
<meta name="abstract" content="There are some special considerations for copy when the from-file is a physical or logical file and one or more members to be copied are empty." />
|
|
<meta name="description" content="There are some special considerations for copy when the from-file is a physical or logical file and one or more members to be copied are empty." />
|
|
<meta name="DC.subject" content="Copy File (CPYF) command, monitoring for zero records, CPYF (Copy File) command, monitoring for zero records, copy command, zero records, from-file, monitoring for zero records, copying file, monitoring, from-file member, empty, MBROPT(*REPLACE) specified, from-file member, empty, example, messages for zero records on copy commands, monitoring for zero records on CPYF command" />
|
|
<meta name="keywords" content="Copy File (CPYF) command, monitoring for zero records, CPYF (Copy File) command, monitoring for zero records, copy command, zero records, from-file, monitoring for zero records, copying file, monitoring, from-file member, empty, MBROPT(*REPLACE) specified, from-file member, empty, example, messages for zero records on copy commands, monitoring for zero records on CPYF command" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbal3bcfuc.htm" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rbal3mzrff" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- 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. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title> Monitoring for zero records in the from-file</title>
|
|
</head>
|
|
<body id="rbal3mzrff"><a name="rbal3mzrff"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1"> Monitoring for zero records in the from-file</h1>
|
|
<div><p>There are some special considerations for copy when the from-file
|
|
is a physical or logical file and one or more members to be copied are empty. </p>
|
|
<div class="p">A member is considered empty in the following cases: <ul><li>You specified COMPRESS(*NO) on the <a href="../cl/cpyf.htm">CPYF</a> command, and the from-file member contains no records.</li>
|
|
<li>You specified COMPRESS(*YES) for a COPY command, and the from-file members
|
|
contain no undeleted records.</li>
|
|
</ul>
|
|
</div>
|
|
<p>Members copied involving record selection <a href="../cl/cpyfrmqryf.htm">(CPYFRMQRYF</a> command or the INCCHAR and INCREL parameters
|
|
of the CPYF command) that produce no records are not considered empty.</p>
|
|
<p>When the to-file is a printer file (including *PRINT), or when the to-file
|
|
is a physical file and you specified MBROPT(*ADD) or MBROPT(*UPDADD), empty
|
|
from-file members are copied because no existing data will be destroyed. Each
|
|
member that is copied is identified by a normal copy completion message. If
|
|
the to-file is spooled, an empty spooled file is produced for each empty from-file
|
|
member. If the PRINT parameter on the CPYF command specifies *COPIED, *EXCLD,
|
|
or *ERROR, the empty members are shown in the lists, and no records are printed.</p>
|
|
<div class="p">Except for the CPYFRMQRYF command, an empty from-file member is never copied
|
|
to a diskette or tape file, or to a physical file when MBROPT(*REPLACE) is
|
|
specified. Empty from-file members are skipped for these types of to-files,
|
|
and a CPF2869 message is sent (as either an informational or diagnostic message)
|
|
to identify each empty member. The empty members are skipped to avoid destroying
|
|
existing data. When an empty from-file member is skipped, the following considerations
|
|
apply: <ul><li>A tape or diskette file is not produced on the output volume. If the diskette
|
|
file is spooled, no spool output file is created.</li>
|
|
<li>An existing to-file physical file member is not cleared.</li>
|
|
<li>If the to-file does not exist and you specified CRTFILE(*YES) on a copy
|
|
command, a physical file is created.</li>
|
|
<li>If the to-file is a physical file and the to-file member does not exist,
|
|
a member is added to the file.</li>
|
|
<li>If the PRINT parameter on the CPYF command specifies *COPIED, *EXCLD,
|
|
or *ERROR, the empty members are not shown in the lists.</li>
|
|
</ul>
|
|
</div>
|
|
<p>When the copy command specifies a generic name or *ALL for the FROMMBR
|
|
parameter, each empty from-file member skipped is identified by message CPF2869,
|
|
sent as an informational message. If all the from-file members are skipped,
|
|
a CPF2870 diagnostic message is sent after all the CPF2869 informational messages,
|
|
followed by a CPF2817 escape message.</p>
|
|
<p>When the copy command specifies a single member name or FROMMBR(*FIRST),
|
|
or when there is an override for the from-file that forces a single member
|
|
to be processed, an empty member that is skipped is identified by the diagnostic
|
|
message CPF2869. The CPF2869 diagnostic message is followed by a CPF2817 escape
|
|
message.</p>
|
|
<div class="p">In the following example, the from-file and to-file are both database files,
|
|
and EMPTY1 and EMPTY2 are empty members in the from-file. <div class="note"><span class="notetitle">Note:</span> By using the
|
|
code examples, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
|
<pre>PGM
|
|
/* No need to monitor for zero records
|
|
when MBROPT(*ADD) specified */
|
|
CPYF FROMFILE(D504/GEORGE) TOFILE(D504/KEN) +
|
|
FROMMBR(EMPTY1) TOMBR(MBR1) MBROPT(*ADD)
|
|
CPYF FROMFILE(D504/GEORGE) TOFILE(D504/KEN) +
|
|
FROMMBR(EMPTY2) TOMBR(MBR2) MBROPT(*REPLACE)
|
|
MONMSG MSGID(CPF2817) CMPDTA(CPF2869) +
|
|
EXEC(CLRPFM FILE(D504/KEN) MBR(MBR2))
|
|
/* Monitor for zero records and
|
|
send a message when all members
|
|
to copy are empty */
|
|
CPYF FROMFILE(D504/GEORGE) +
|
|
TOFILE(D504/NEWFILE) FROMMBR(EMPTY*) +
|
|
TOMBR(NEWMBR) MBROPT(*REPLACE)
|
|
MONMSG MSGID(CPF2817) CMPDTA(CPF2870) +
|
|
EXEC(SNDPGMMSG TOPGMQ(*EXT) +
|
|
MSG('All members to copy are empty'))
|
|
ENDPGM</pre>
|
|
</div>
|
|
<p>For the first <a href="../cl/cpyf.htm">CPYF</a> command,
|
|
MBROPT(*ADD) is specified, so an escape message is not sent to the program
|
|
because of the empty from-file member. Note that if MBR1 does not exist before
|
|
the copy, it is added to the to-file (if either the from-file member is empty
|
|
or contains data).</p>
|
|
<p>For the second CPYF command, copy does not clear the to-file member when
|
|
the from-file member is empty, so the <a href="../cl/monmsg.htm">MONMSG</a> command after the second CPYF command starts the
|
|
CLRPFM command to clear the to-file member when the from-file member is empty.</p>
|
|
<p>For the third CPYF command, the CPF2817 escape message has compare data
|
|
of CPF2870 if all members to be copied are empty because the generic from-file
|
|
member name, EMPTY*, requests that multiple members be copied.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal3bcfuc.htm" title="You can copy from a physical or logical database file, open query file, diskette file, tape file, or inline data file. The to-file can be a physical database file, diskette file, tape file, program-described printer file, or *PRINT.">Copy files: basic functions</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |