ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/callpgmasbase.htm

85 lines
5.8 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="concept" />
<meta name="DC.Title" content="Use the program boundary as a base" />
<meta name="abstract" content="You can specify the program boundary as the base call stack entry by using the *PGMBDY special value." />
<meta name="description" content="You can specify the program boundary as the base call stack entry by using the *PGMBDY special value." />
<meta name="DC.subject" content="example, using *PGMBDY" />
<meta name="keywords" content="example, using *PGMBDY" />
<meta name="DC.Relation" scheme="URI" content="callid.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="callpgmasbase" />
<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>Use the program boundary as a base</title>
</head>
<body id="callpgmasbase"><a name="callpgmasbase"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use the program boundary as a base</h1>
<div><p>You can specify the program boundary as the base call stack entry
by using the *PGMBDY special value. </p>
<p>The special value *PGMBDY is used by itself or with a program name to identify
the PEP of a CL program. The entry for the PEP of the identified CL program
then is the base entry. This option is useful when you want to send a message
from within a CL procedure outside the boundary of the program which contains
the procedure.</p>
<p>Refer to the first figure for an example of sending a message using the
special value *PGMBDY. In this example, CLPROC4 is sending a message directly
to to CLPGM1 which is the caller of the containing program CLPGM2. CLPROC4
can do this without knowing which program called CLPGM2 or knowing the location
of the PEP compared to the procedure sending the message. In this example,
*PGMBDY is used without an accompanying program name specified. This means
that the program whose boundary is to be identified is the program which contains
the procedure that is sending the message.</p>
<p>See the second figure for an example of sending a message using the special
value *PGMBDY and a program name. The following programs and procedures are
used in the second figure:</p>
<ul><li>CLPGM1 and CLPGM2. These are defined as in the previous examples.</li>
<li>CLPGM3. This is another ILE program</li>
<li>CLPROCA in CLPGM3. A message is sent from CLPROCA to the caller of CLPGM2.</li>
</ul>
<p>A message is sent from CLPROCA to the caller of CLPGM2 by using the special
value *PGMBDY with program name CLPGM2.</p>
<p>In this example, if the TOPGMQ parameter is specified as TOPGMQ(*PRV _CL_PEP),
the message is sent to the caller of CLPGM3 rather than the caller of CLPGM2.
This occurs because the most recently called procedure by that name is the
PEP for CLPGM3.</p>
<div class="fignone" id="callpgmasbase__sndfig5"><a name="callpgmasbase__sndfig5"><!-- --></a><span class="figcap">Figure 1. Example of using *PGMBDY as a simple name</span><br /><img src="rbafn567.gif" alt="" /><br /></div>
<div class="fignone" id="callpgmasbase__sndfig6"><a name="callpgmasbase__sndfig6"><!-- --></a><span class="figcap">Figure 2. Example of using *PGMBDY in a complex name</span><br /><img src="rbafn568.gif" alt="" /><br /></div>
<p>The special value *PGMBDY can also be used with an OPM program. If you
specify an OPM program name with *PGMBDY, you have the same results as when
only the OPM program name is used. For example, TOPGMQ(*SAME *PGMBDY *NONE
opmname) sends the message to the same place as TOPGMQ(*SAME opmname).The
exception to this is when a message is sent to an OPM program that called
itself recursively. TOPGMQ(*SAME pgmname) sends the message to the latest
recursion level. However, TOPGMQ(*SAME *PGMBDY *NONE pgmname) sends the message
to the first recursion level. The figure below shows how PGM1 is called and
proceeds to call itself recursively two more times. At the third recursion
level PGM1 calls PGM2. PGM2 then sends a message back to PGM1. If the program
is sent using only the name PGM1, the message goes to the third recursion
level of PGM1. If the program is sent using the name PGM1 in conjunction with
the special value *PGMBDY, the message goes to the first recursion level of
PGM1.</p>
<div class="fignone" id="callpgmasbase__sndfig7"><a name="callpgmasbase__sndfig7"><!-- --></a><span class="figcap">Figure 3. Example of using *PGMBDY with an OPM name with recursion</span><br /><img src="rbafn569.gif" alt="" /><br /></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="callid.htm" title="If a CL procedure is to send a message to an OPM program or another ILE procedure, you must identify the call stack entry to which the message is sent.">Identify a call stack entry</a></div>
</div>
</div>
</body>
</html>