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

140 lines
7.3 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="Write a CL program to control a menu" />
<meta name="abstract" content="This example shows how a CL procedure can be written to display and control a menu." />
<meta name="description" content="This example shows how a CL procedure can be written to display and control a menu." />
<meta name="DC.subject" content="example, controlling menu, control language (CL), program, menu, using CL program to control" />
<meta name="keywords" content="example, controlling menu, control language (CL), program, menu, using CL program to control" />
<meta name="DC.Relation" scheme="URI" content="wfile.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/sndf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/rcvf.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/sndrcvf.htm" />
<meta name="DC.Relation" scheme="URI" content="../rzahg/rzahgapdlprint.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="cmenu" />
<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>Write a CL program to control a menu</title>
</head>
<body id="cmenu"><a name="cmenu"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Write a CL program to control a menu</h1>
<div><p>This example shows how a CL procedure can be written to display
and control a menu.</p>
<div class="section"> <p>This example shows a CL procedure, ORD040C, that controls the
displaying of the order department general menu and determines which HLL procedure
to call based on the option selected from the menu. The procedure shows the
menu at the display station.</p>
<div class="p">The order department general menu looks
like this: <pre class="screen"> Order Dept General Menu
1 Inquire into customer file
2 Inquire into item file
3 Customer name search
4 Inquire into orders for a customer
5 Inquire into an existing order
6 Order entry
98 End of menu
Option:
</pre>
</div>
<p>The DDS for the display file ORD040C looks like this:</p>
<div class="fignone"><pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A* MENU ORDO4OCD ORDER DEPT GENERAL MENU
A
A R MENU TEXT('General Menu')
A 1 2'Order Dept General Menu'
A 3 3'1 Inquire into customer file'
A 4 3'2 Inquire into item file'
A 5 3'3 Customer name search'
A 6 3'4 Inquire into orders for a custom+
A er'
A 7 3'5 Inquire into existing order'
A 8 3'6 Order Entry'
A 9 2'98 End of menu'
A 11 2'Option'
A RESP 2Y001 11 10VALUES(1 2 3 4 5 6 98)
A DSPATR(MDT)
A
A</pre>
</div>
<p>The source procedure for ORD040C looks like this: </p>
<pre>
PGM /* ORD040C Order Dept General Menu */
DCLF FILE(ORD040CD)
START: SNDRCVF RCDFMT(MENU)
SELECT
WHEN (&amp;RESP=1) THEN(CALLPRC CUS210) /* Customer inquiry */
WHEN (&amp;RESP=2) THEN(CALLPRC ITM210) /* Item inquiry */
WHEN (&amp;RESP=3) THEN(CALLPRC CUS220) /* Cust name search */
WHEN (&amp;RESP=4) THEN(CALLPRC ORD215) /* Orders by cust */
WHEN (&amp;RESP=5) THEN(CALLPRC ORD220) /* Existing order */
WHEN (&amp;RESP=6) THEN(CALLPRC ORD410C) /* Order entry */
WHEN (&amp;RESP=98) THEN(RETURN) /* End of Menu */
ENDSELECT
GOTO START
ENDPGM </pre>
<p>The DCLF command indicates which file contains the field attributes
the system needs to format the order department general menu when the <span class="cmdname">Send/Receive
File (SNDRCVF)</span> command is processed. The system automatically declares
a variable for each field in the record format in the specified file if that
record format is used in an <span class="cmdname">Send File (SNDF)</span>, <span class="cmdname">Receive
File (RCVF)</span>, or <span class="cmdname">Send/Receive File (SNDRCVF)</span> command.
The variable name for each field automatically declared is an ampersand (&amp;)
followed by the field name. For example, the variable name of the response
field RESP in ORD040C is &amp;RESP.</p>
<p>Other notes on the operation of
this menu:</p>
<ul><li>The <span class="cmdname">Send/Receive File (SNDRCVF)</span> command is used to
send the menu to the display and to receive the option selected from the display.</li>
<li>If the option selected from the menu is <samp class="codeph">98</samp>, ORD040C returns
to the procedure that called it.</li>
<li>The ELSE statements are necessary to process the responses as mutually
exclusive alternatives.</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> This menu is run using the <span class="cmdname">Call (CALL)</span> command.
See the Application Display Programming book for a discussion of those menus
run using the <span class="cmdname">Go (GO)</span> command.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <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>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../cl/sndf.htm">Send File (SNDF) command</a></div>
<div><a href="../cl/rcvf.htm">Receive File (RCVF) command</a></div>
<div><a href="../cl/sndrcvf.htm">Send/Receive File (SNDRCVF) command</a></div>
<div><a href="../rzahg/rzahgapdlprint.htm">Application Display Programming</a></div>
</div>
</div>
</body>
</html>