117 lines
6.7 KiB
HTML
117 lines
6.7 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="reference" />
|
||
|
<meta name="DC.Title" content="Example 1: A single set of files with similar processing options" />
|
||
|
<meta name="abstract" content="In this example, the user signs on and most of the programs that are used process the same set of files." />
|
||
|
<meta name="description" content="In this example, the user signs on and most of the programs that are used process the same set of files." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafoclose.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../books/sc415606.pdf" />
|
||
|
<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="rbafocloseex1" />
|
||
|
<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>Example 1: A single set of files with similar processing options</title>
|
||
|
</head>
|
||
|
<body id="rbafocloseex1"><a name="rbafocloseex1"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example 1: A single set of files with similar processing options</h1>
|
||
|
<div><p>In this example, the user signs on and most of the programs that
|
||
|
are used process the same set of files.</p>
|
||
|
<div class="section"><div class="p">A control language (CL) program (PGMA) is used as the first program
|
||
|
(to set up the application, including overrides and opening the shared files).
|
||
|
PGMA then transfers control to PGMB, which displays the application menu.
|
||
|
Assume, in this example, that files A, B, and C are used, and files A and
|
||
|
B are to be shared. Files A and B were created with SHARE(*NO); therefore
|
||
|
the Override with Database File (OVRDBF) command should precede each of the
|
||
|
Open Database File (OPNDBF) commands to specify the SHARE(*YES) option. File
|
||
|
C was created with SHARE(*NO) and File C is not to be shared in this example.
|
||
|
<div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
|
||
|
<pre>PGMA: PGM /* PGMA - Initial program */
|
||
|
OVRDBF FILE(A) SHARE(*YES)
|
||
|
OVRDBF FILE(B) SHARE(*YES)
|
||
|
OPNDBF FILE(A) OPTION(*ALL) ....
|
||
|
OPNDBF FILE(B) OPTION(*INP) ...
|
||
|
TFRCTL PGMB
|
||
|
ENDPGM
|
||
|
|
||
|
|
||
|
|
||
|
PGMB: PGM /* PGMB - Menu program */
|
||
|
DCLF FILE(DISPLAY)
|
||
|
BEGIN: SNDRCVF RCDFMT(MENU)
|
||
|
IF (&RESPONSE *EQ '1') CALL PGM11
|
||
|
IF (&RESPONSE *EQ '2') CALL PGM12
|
||
|
.
|
||
|
.
|
||
|
IF (&RESPONSE *EQ '90') SIGNOFF
|
||
|
GOTO BEGIN
|
||
|
ENDPGM</pre>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><p>The files opened in PGMA are either scoped to the job, or PGMA,
|
||
|
PGM11, and PGM12 run in the same activation group and the file opens are scoped
|
||
|
to that activation group.</p>
|
||
|
</div>
|
||
|
<div class="section"><div class="p">In this example, assume that: <ul><li>PGM11 opens files A and B. Because these files were opened as shared by
|
||
|
the OPNDBF commands in PGMA, the open time is reduced. The close time is also
|
||
|
reduced when the shared open data path is closed. The OVRDBF commands remain
|
||
|
in effect even though control is transferred (with the Transfer Control (TFRCTL)
|
||
|
command in PGMA) to PGMB.</li>
|
||
|
<li>PGM12 opens files A, B, and C. File A and B are already opened as shared
|
||
|
and the open time is reduced. Because file C is used only in this program,
|
||
|
the file is not opened as shared.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><div class="p">In this example, the Close File (CLOF) was not used because only
|
||
|
one set of files is required. When the operator signs off, the files are automatically
|
||
|
closed. It is assumed that PGMA (the initial program) is called only at the
|
||
|
start of the job. For more information about how to reclaim resources in the
|
||
|
Integrated Language Resources, see the ILE Concepts book.<div class="note"><span class="notetitle">Note:</span> The display
|
||
|
file (DISPLAY) in PGMB can also be specified as a shared file, which can improve
|
||
|
the performance for opening the display file in any programs that use it later.</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="section"><p>In Example 1, the OPNDBF commands are placed in a separate program
|
||
|
(PGMA) so the other processing programs in the job run as efficiently as possible.
|
||
|
That is, the important files used by the other programs in the job are opened
|
||
|
in PGMA. After the files are opened by PGMA, the main processing programs
|
||
|
(PGMB, PGM11, and PGM12) can share the files; therefore, their open and close
|
||
|
requests will process faster. In addition, by placing the open commands (OPNDBF)
|
||
|
in PGMA rather than in PGMB, the amount of main storage used for PGMB is reduced.</p>
|
||
|
</div>
|
||
|
<div class="section"><p>Any overrides and opens can be specified in the initial program
|
||
|
(PGMA); then, that program can be removed from the job (for example, by transferring
|
||
|
out of it). However, the open data paths that the program created when it
|
||
|
opened the files remain in existence and can be used by other programs in
|
||
|
the job.</p>
|
||
|
</div>
|
||
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> Overrides must be specified before the file is opened. Some
|
||
|
of the parameters on the OVRDBF command also exist on the OPNDBF command.
|
||
|
If conflicts arise, the OVRDBF value is used.</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafoclose.htm" title="Listed here are the considerations for closing a database file that is shared in the same job or activation group.">Close considerations for files shared in a job or activation group</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="../books/sc415606.pdf" target="_blank">ILE Concepts PDF</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|