105 lines
8.6 KiB
HTML
105 lines
8.6 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="copyright" content="(C) Copyright IBM Corporation 2005" />
|
|||
|
<meta name="DC.rights.owner" content="(C) Copyright IBM Corporation 2005" />
|
|||
|
<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="Apply overrides when compiling a program" />
|
|||
|
<meta name="abstract" content="Overrides can be applied at the time a program is being compiled for either of two purposes: to select the source file, or to provide external data definitions for the compiler to use in defining the record formats to be used on I/O operations." />
|
|||
|
<meta name="description" content="Overrides can be applied at the time a program is being compiled for either of two purposes: to select the source file, or to provide external data definitions for the compiler to use in defining the record formats to be used on I/O operations." />
|
|||
|
<meta name="DC.subject" content="overriding file, applying, when compiling program, applying override, when compiling program, override, source files, file, source overrides, source file, overrides, external data definitions, LVLCHK (level check) parameter, *NO value, level check (LVLCHK) parameter, *NO value, example, externally described file, parameter, LVLCHK(*NO) with overrides, externally described" />
|
|||
|
<meta name="keywords" content="overriding file, applying, when compiling program, applying override, when compiling program, override, source files, file, source overrides, source file, overrides, external data definitions, LVLCHK (level check) parameter, *NO value, level check (LVLCHK) parameter, *NO value, example, externally described file, parameter, LVLCHK(*NO) with overrides, externally described" />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rbal3applyovr.htm" />
|
|||
|
<meta name="DC.Relation" scheme="URI" content="rbal3eoscd.htm" />
|
|||
|
<meta name="DC.Format" content="XHTML" />
|
|||
|
<meta name="DC.Identifier" content="rbal3aowcp" />
|
|||
|
<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>Apply overrides when compiling a program</title>
|
|||
|
</head>
|
|||
|
<body id="rbal3aowcp"><a name="rbal3aowcp"><!-- --></a>
|
|||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|||
|
<h1 class="topictitle1">Apply overrides when compiling a program</h1>
|
|||
|
<div><p>Overrides can be applied at the time a program is being compiled
|
|||
|
for either of two purposes: to select the source file, or to provide external
|
|||
|
data definitions for the compiler to use in defining the record formats to
|
|||
|
be used on I/O operations.</p>
|
|||
|
<p>Overrides to the source file are handled just like any other
|
|||
|
override. They can select another file, another member of a database file,
|
|||
|
another label for diskette or tape, or change other file attributes.</p>
|
|||
|
<p>You can also apply overrides to files that are used within the program
|
|||
|
being compiled, if they are being used as externally described files in the
|
|||
|
program. These files are not opened at compile time, and thus the overrides
|
|||
|
are not applied in the normal manner. These overrides are used at compile
|
|||
|
time only to determine the file name and library that will be used to define
|
|||
|
the record formats and fields for the program to use I/O operations. Any
|
|||
|
other file attributes specified on the override are ignored at compile time. It is necessary that these file overrides be active at compile time only
|
|||
|
if the file name specified in the source for the program is not the file name
|
|||
|
that contains the record formats that the application needs.</p>
|
|||
|
<p>The file name that is opened when the compiled program is run is determined
|
|||
|
by the file name that the program source refers to, changed by whatever overrides
|
|||
|
are in effect at the time the program runs. The file name used at compile
|
|||
|
time is not kept. The record formats in the file that is actually opened
|
|||
|
must be compatible with those that were used when the program was compiled. Obviously, the easiest way to assure that records are compatible is to have
|
|||
|
the same overrides active at run time that were active at compile time. If
|
|||
|
your program uses externally described data and a different field level file
|
|||
|
is used at run time, it is typically necessary to specify LVLCHK(*NO) on the
|
|||
|
override. See <a href="rbal3redirect.htm#rbal3redirect">Redirect files</a> for details.</p>
|
|||
|
<p>The following example shows how overrides work when compiling a program:</p>
|
|||
|
<div class="fignone"><span class="figcap">Figure 1. An example over overrides when compiling a program</span>. <span class="figdesc">The
|
|||
|
following example shows how overrides work when compiling a program.</span><p>Override 1 <span><samp class="codeph">OVRDBF FILE(RPGSRC) +</samp></span><br />
|
|||
|
<span><samp class="codeph">TOFILE(SRCPGMS) MBR(INVN42)</samp></span><br />
|
|||
|
Override 2 <span><samp class="codeph">OVRPRTF FILE(OUTPUT) TOFILE(REPORTS)</samp></span><br />
|
|||
|
<span><samp class="codeph">CALL PGM(A)</samp></span><br />
|
|||
|
<br />
|
|||
|
Program A<br />
|
|||
|
Override 3 <span><samp class="codeph">OVRPRTF FILE(LISTOUT) +</samp></span><br />
|
|||
|
<span><samp class="codeph">TOFILE(OUTPUT)</samp></span><br />
|
|||
|
Override 4 <span><samp class="codeph">OVRDBF FILE(RPGSRC) WAITFILE(30)</samp></span><br />
|
|||
|
<span><samp class="codeph">CRTRPGPGM PGM(INVENTORY) +</samp></span><br />
|
|||
|
<span><samp class="codeph">SRCFILE(RPGSRC)</samp></span><br />
|
|||
|
<span><samp class="codeph">RETURN</samp></span><br />
|
|||
|
<br />
|
|||
|
Override 5 <span><samp class="codeph">OVRPRTF FILE(LISTOUT) +</samp></span><br />
|
|||
|
<span><samp class="codeph">TOFILE(REPORTS) LPI(8)</samp></span><br />
|
|||
|
<span><samp class="codeph">CALL PGM(INVENTORY)</samp></span></p>
|
|||
|
</div>
|
|||
|
<p>The program INVENTORY opens the printer file REPORTS in place of printer
|
|||
|
file LISTOUT and creates output at 8 lines per inch.</p>
|
|||
|
<p>The program INVENTORY is created (compiled) from the member INVN42 in the
|
|||
|
database file SRCPGMS. Override 4, which is applied first, overrides an optional
|
|||
|
file attribute. Override 1, which is applied last, causes the file RPGSRC
|
|||
|
to be overridden with the database file SRCPGMS, member INVN42.</p>
|
|||
|
<p>The program INVENTORY is created with the printer formats from the file
|
|||
|
REPORTS. Assume that the source for the program INVENTORY, which is taken
|
|||
|
from file SRCPGMS and member INVN42, contains an open to the printer file
|
|||
|
LISTOUT. Override 3, which is applied first, causes the file LISTOUT to be
|
|||
|
overridden with OUTPUT. Override 2, which is applied last, overrides OUTPUT
|
|||
|
with REPORTS. Other attributes can be specified here, but it is not necessary
|
|||
|
because only the record formats are used at compile time.</p>
|
|||
|
<p>At run time, override 3 is no longer active, because program A has ended. Therefore override 2 has no effect on LISTOUT. However, override 5, which
|
|||
|
is active at run time, replaces LISTOUT with REPORTS and specifies 8 lines
|
|||
|
per inch. Because the same file is used for compilation and run-time, you
|
|||
|
can leave level checking on.</p>
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<div class="familylinks">
|
|||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal3applyovr.htm" title="You can perform two general types of overrides, which are file overrides and overrides for program device entries.">Apply overrides</a></div>
|
|||
|
</div>
|
|||
|
<div class="relref"><strong>Related reference</strong><br />
|
|||
|
<div><a href="rbal3eoscd.htm" title="Some commands ignore overrides entirely, while others allow overrides only for certain parameters.">Effect of overrides on some commands</a></div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|