116 lines
6.0 KiB
HTML
116 lines
6.0 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="Access objects in CL programs" />
|
||
<meta name="abstract" content="To access an object from a CL program, the object must be in the specified library when the command that refers to it runs." />
|
||
<meta name="description" content="To access an object from a CL program, the object must be in the specified library when the command that refers to it runs." />
|
||
<meta name="DC.Relation" scheme="URI" content="objec.htm" />
|
||
<meta name="DC.Relation" scheme="URI" content="except.htm" />
|
||
<meta name="DC.Relation" scheme="URI" content="check.htm" />
|
||
<meta name="DC.Relation" scheme="URI" content="parts.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="acces" />
|
||
<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>Access objects in CL programs</title>
|
||
</head>
|
||
<body id="acces"><a name="acces"><!-- --></a>
|
||
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
<h1 class="topictitle1">Access objects in CL programs</h1>
|
||
<div><p>To access an object from a CL program, the object must be in the
|
||
specified library when the command that refers to it runs.</p>
|
||
<div class="section"> <p> Rules that refer to objects in CL program commands and procedures
|
||
are the same as objects in commands that are processed individually (not within
|
||
a program). Object names can be either qualified or unqualified. Locate an
|
||
unqualified object name through a search of the library list.</p>
|
||
<p>Most objects
|
||
referred to in CL procedures and programs are not accessed until the command
|
||
referring to them is run. To qualify the name (<em>library/name</em>) of an
|
||
object, it must be in the specified library when the command that refers to
|
||
it runs. However, the object does not have to be in that library at the creation
|
||
of the program. This means that most objects can be qualified in CL source
|
||
statements that are simply based only on their run–time location.</p>
|
||
<p>You
|
||
can avoid this run–time consideration for all objects if you do not qualify
|
||
object names on CL source statements, but refer to the library list (*LIBL/name)
|
||
instead. If you refer to the library list at compile time, the object can
|
||
be in any library on the library list at command run time. This is possible
|
||
providing you do not have duplicate-name objects in different libraries.
|
||
If you use the library list, you can move the object to a different library
|
||
between procedure creation and command processing.</p>
|
||
<p>Objects do not need
|
||
to exist until the command that refers to them runs. Because of this, the
|
||
CL program successfully compiles even though program PAYROLL does not exist
|
||
at compile time: </p>
|
||
<pre> PGM /*TEST*/
|
||
DCL...
|
||
MONMSG...
|
||
.
|
||
.
|
||
.
|
||
CALL PGM(QGPL/PAYROLL)
|
||
.
|
||
.
|
||
.
|
||
ENDPGM
|
||
</pre>
|
||
<p>In fact, PAYROLL does not have to exist when activating the
|
||
program TEST, but only when running the <span class="cmdname">Call (CALL</span>) command.
|
||
This creates the called program within the calling program immediately prior
|
||
to the <span class="cmdname">Call (CALL</span> command: </p>
|
||
<pre> PGM /*TEST*/
|
||
DCL...
|
||
.
|
||
.
|
||
.
|
||
MONMSG
|
||
.
|
||
.
|
||
.
|
||
CRTCLPGM PGM(QGPL/PAYROLL)
|
||
CALL PGM(QGPL/PAYROLL)
|
||
.
|
||
.
|
||
.
|
||
ENDPGM
|
||
</pre>
|
||
<p>Note that for create commands, such as <span class="cmdname">Create CL Program
|
||
(CRTCLPGM)</span> or <span class="cmdname">Create Data Area (CRTDTAARA)</span>, the
|
||
object that is accessed at compile or run time is the create command definition,
|
||
not the created object. If you are using a create command, the create command
|
||
definition must be in the library that is used to qualify the command at compile
|
||
time. (Alternately, it must be in a library on the library list if you used
|
||
*LIBL.)</p>
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<ul class="ullinks">
|
||
<li class="ulchildlink"><strong><a href="except.htm">Access command definitions, files, and procedures</a></strong><br />
|
||
To access command definitions or files from a CL program, the command definitions or files must exist at creation time of the program and must exist when the command that refers to them runs.</li>
|
||
<li class="ulchildlink"><strong><a href="check.htm">Check for the existence of an object</a></strong><br />
|
||
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.</li>
|
||
</ul>
|
||
|
||
<div class="familylinks">
|
||
<div class="parentlink"><strong>Parent topic:</strong> <a href="objec.htm" title="This provides tasks and concepts specific to objects and libraries, including functions performed on objects, creating libraries, and specifying object authority.">Objects and libraries</a></div>
|
||
</div>
|
||
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
<div><a href="parts.htm" title="While each source statement entered as part of a CL procedure is actually a CL command, the source can be divided into the basic parts used in many typical CL procedures.">Parts of a CL procedure</a></div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html> |