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

127 lines
8.2 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?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="Parts of a CL procedure" />
<meta name="abstract" content="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." />
<meta name="description" content="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." />
<meta name="DC.subject" content="CL procedure, parts, control language (CL), procedure, parts of CL, description, PGM (Program) command, command, CL, Program (PGM) command, variable, changing, CL procedure, program, ending" />
<meta name="keywords" content="CL procedure, parts, control language (CL), procedure, parts of CL, description, PGM (Program) command, command, CL, Program (PGM) command, variable, changing, CL procedure, program, ending" />
<meta name="DC.Relation" scheme="URI" content="creat.htm" />
<meta name="DC.Relation" scheme="URI" content="acces.htm" />
<meta name="DC.Relation" scheme="URI" content="wfile.htm" />
<meta name="DC.Relation" scheme="URI" content="cflow.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/crtpf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/crtlf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/crtdspf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/dclf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/call.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/callprc.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="parts" />
<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>Parts of a CL procedure</title>
</head>
<body id="parts"><a name="parts"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Parts of a CL procedure</h1>
<div><p>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. </p>
<dl><dt class="dlterm">PGM command</dt>
<dd><samp class="codeph">PGM PARM(&amp;A)</samp> <p>Optional PGM command beginning the
procedure and identifying any parameters received.</p>
</dd>
<dt class="dlterm">Declare commands</dt>
<dd>(<samp class="codeph">DCL, DCLF, COPYRIGHT, DCLPRCOPT</samp>) <p>Mandatory declaration
of procedure variables when variables are used, and optional definition of
the size of the subroutine stack. The declare commands must precede all other
commands except the PGM command.</p>
</dd>
<dt class="dlterm">CL processing commands</dt>
<dd><samp class="codeph">CHGVAR, SNDPGMMSG, OVRDBF, DLTF,</samp><p>CL commands used
as source statements to manipulate constants or variables (this is a partial
list).</p>
</dd>
<dt class="dlterm">Logic control commands</dt>
<dd><samp class="codeph">IF, THEN, ELSE, DO, ENDDO, DOWHILE, DOUNTIL, DOFOR, LEAVE, ITERATE,
GOTO, SELECT, ENDSELECT, WHEN, OTHERWISE, CALLSUBR, SUBR, RTNSUBR, ENDSUBR</samp> <p>Commands
used to control processing within the CL procedure.</p>
</dd>
<dt class="dlterm">Built-in functions</dt>
<dd><samp class="codeph"><img src="./delta.gif" alt="Start of change" />%SUBSTRING (%SST), %SWITCH, %BINARY (%BIN), %ADDRESS
(%ADDR), %OFFSET (%OFS)<img src="./deltaend.gif" alt="End of change" /></samp> <p>Built-in functions and operators used
in arithmetic, relational or logical expressions.</p>
</dd>
<dt class="dlterm">Program control commands</dt>
<dd><samp class="codeph">CALL, RETURN</samp> <p>CL commands used to pass control to
other programs.</p>
</dd>
<dt class="dlterm">Procedure control commands</dt>
<dd><samp class="codeph">CALLPRC, RETURN</samp> <p>CL commands used to pass control
to other procedures.</p>
</dd>
<dt class="dlterm">ENDPGM command</dt>
<dd><samp class="codeph">ENDPGM</samp> <p>Optional End Program command.</p>
</dd>
</dl>
<p>The sequence, combination, and extent of these components
are determined by the logic and design of your application.</p>
<div class="p">A CL procedure may refer to other objects that must exist when the procedure
is created, when the command is processed, or both. In some circumstances,
for your procedure to run successfully, you may need: <ul><li>A display file. Use display files to format information on a device display.
If your procedure uses a display, you must enter and create the display file
and record format by using the <span class="cmdname">Create Display File (CRTDSPF)</span> command
before creating the module. You must declare it to the procedure in the declare
section by using the <span class="cmdname">Declare File (DCLF)</span> command.</li>
<li>A database file. Records in a database file may be read by a CL procedure.
If your procedure uses a database file, the file must be created using the <span class="cmdname">Create
Physical File (CRTPF)</span> command or the <span class="cmdname">Create Logical File
(CRTLF)</span> command before the module is created. You can use Data Description
Specifications (DDS), Structured Query Language (SQL), or interactive data
definition utility (IDDU) to define the format of the records in the file.
The file must also be declared to the procedure in the DCL section using
the <span class="cmdname">Declare File (DCLF)</span> command.</li>
<li>Other programs. If you use a CALL command, the called program must exist
before running the CALL command. It does not have to exist when compiling
the calling module.</li>
<li>Other procedures. If you use the CALLPRC command, the called procedure
must exist at the time CRTPGM is run. It does not have to exist when CRTCLMOD
is run.</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="creat.htm" title="All programs are created in steps.">Create a CL procedure</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><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><a href="wfile.htm" title="Two types of files are supported in CL procedures and programs: display files and database files.">Work with files in CL procedures</a></div>
<div><a href="cflow.htm" title="You can use the Call Program (CALL), Call Bound Procedure (CALLPRC), and Return (RETURN) commands to pass control back and forth between programs and procedures.">Control flow and communicate between programs and procedures</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../cl/crtpf.htm">Create Physical File (CRTPF) command</a></div>
<div><a href="../cl/crtlf.htm">Create Logical File (CRTLF) command</a></div>
<div><a href="../cl/crtdspf.htm">Create Display File (CRTDSPF) command</a></div>
<div><a href="../cl/dclf.htm">Declare File (DCLF) command</a></div>
<div><a href="../cl/call.htm">Call (CALL) command</a></div>
<div><a href="../cl/callprc.htm">Call Bound Procedure (CALLPRC) command</a></div>
</div>
</div>
</body>
</html>