93 lines
5.9 KiB
HTML
93 lines
5.9 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="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="task" />
|
||
|
<meta name="DC.Title" content="Check for the existence of an object" />
|
||
|
<meta name="abstract" content="Before attempting to use an object in a program, check to determine if the object exists and if you have the authority to use it." />
|
||
|
<meta name="description" content="Before attempting to use an object in a program, check to determine if the object exists and if you have the authority to use it." />
|
||
|
<meta name="DC.subject" content="CHKOBJ (Check Object) command, Check Object (CHKOBJ) command, Check Object (CHKOBJ) command, command, CL, CHKOBJ (Check Object), Check Object (CHKOBJ), object, checking" />
|
||
|
<meta name="keywords" content="CHKOBJ (Check Object) command, Check Object (CHKOBJ) command, Check Object (CHKOBJ) command, command, CL, CHKOBJ (Check Object), Check Object (CHKOBJ), object, checking" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="acces.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../cl/chkobj.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="monms.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="msghd.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="wmsgs.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="check" />
|
||
|
<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>Check for the existence of an object</title>
|
||
|
</head>
|
||
|
<body id="check"><a name="check"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Check for the existence of an object</h1>
|
||
|
<div><p>Before attempting to use an object in a program, check to determine
|
||
|
if the object exists and if you have the authority to use it.</p>
|
||
|
<div class="section"> <p>This is useful when a function uses more than one object at one
|
||
|
time.</p>
|
||
|
<p>To check for the existence of an object, use the <span class="cmdname">Check
|
||
|
Object (CHKOBJ)</span> command. You can use this command at any place
|
||
|
in a procedure or program. The <span class="cmdname">Check Object (CHKOBJ)</span> command
|
||
|
has the following format: </p>
|
||
|
<pre>CHKOBJ OBJ(library-name/object-name) OBJTYPE(object-type)</pre>
|
||
|
<p>Other optional parameters allow object authorization verification.
|
||
|
If you are checking for authorization and intend to open a file, you should
|
||
|
check for both operational and data authority.</p>
|
||
|
<p>When this
|
||
|
command runs, the system sends messages to the program or procedure to report
|
||
|
the result of the object check. You can monitor for these messages and handle
|
||
|
them as you wish. For example: </p>
|
||
|
<pre> CHKOBJ OBJ(OELIB/PGMA) OBJTYPE(*PGM)
|
||
|
MONMSG MSGID(CPF9801) EXEC(GOTO NOTFOUND)
|
||
|
CALL OELIB/PGMA
|
||
|
.
|
||
|
.
|
||
|
.
|
||
|
NOTFOUND: CALL FIX001 /*PGMA Not Found Routine*/
|
||
|
ENDPGM</pre>
|
||
|
<p>In this example, the <span class="cmdname">Monitor Message (MONMSG)</span> command
|
||
|
checks only for the object-not-found escape message. For a list of all the
|
||
|
messages which the <span class="cmdname">Check Object (CHKOBJ)</span> command may send
|
||
|
see the online help information for the <span class="cmdname">Check Object (CHKOBJ)</span> command. </p>
|
||
|
<p>The <span class="cmdname">Check
|
||
|
Object (CHKOBJ)</span> command does not allocate an object. For many application
|
||
|
uses the check for existence is not an adequate function, the application
|
||
|
should allocate the object. The <span class="cmdname">Allocate Object (ALCOBJ)</span> command
|
||
|
provides both an existence check and allocation.</p>
|
||
|
<p>Use the <span class="cmdname">Check
|
||
|
Tape (CHKTAP)</span> or <span class="cmdname">Check Diskette (CHKDKT)</span> command
|
||
|
to ensure that a specific tape or diskette is placed on the drive and ready.
|
||
|
These commands also provide an escape message that you can monitor for in
|
||
|
your CL program.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="acces.htm" title="To access an object from a CL program, the object must be in the specified library when the command that refers to it runs.">Access objects in CL programs</a></div>
|
||
|
</div>
|
||
|
<div class="reltasks"><strong>Related tasks</strong><br />
|
||
|
<div><a href="msghd.htm" title="Predefined messages are stored in a message file.">Define message descriptions</a></div>
|
||
|
<div><a href="wmsgs.htm" title="This discusses some of the ways that messages can be used to communicate between users and programs.">Messages</a></div>
|
||
|
</div>
|
||
|
<div class="relref"><strong>Related reference</strong><br />
|
||
|
<div><a href="monms.htm" title="The Monitor Message (MONMSG) command is used to monitor for escape, notify, or status messages sent to the call stack of the procedure in which the Monitor Message (MONMSG) command is used.">Monitor Message (MONMSG) Command</a></div>
|
||
|
</div>
|
||
|
<div class="relinfo"><strong>Related information</strong><br />
|
||
|
<div><a href="../cl/chkobj.htm">Check Object (CHKOBJ) command</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|