94 lines
6.2 KiB
HTML
94 lines
6.2 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="Example: Program that uses a physical, display, and printer file" />
|
||
|
<meta name="abstract" content="This sample program shown in this topic illustrates the use of externally described data in a program." />
|
||
|
<meta name="description" content="This sample program shown in this topic illustrates the use of externally described data in a program." />
|
||
|
<meta name="DC.subject" content="examples of DDS, program using physical, display, and printer files" />
|
||
|
<meta name="keywords" content="examples of DDS, program using physical, display, and printer files" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="examples.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="physdispprintexamp" />
|
||
|
<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: Program that uses a physical, display, and printer file</title>
|
||
|
</head>
|
||
|
<body id="physdispprintexamp"><a name="physdispprintexamp"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Example: Program that uses a physical, display, and printer file</h1>
|
||
|
<div><p>This sample program shown in this topic illustrates the use of
|
||
|
externally described data in a program.</p>
|
||
|
<p>If you enter the DDS for these files on your system and create them using
|
||
|
the Create Physical File (CRTPF) command, the Create Display File (CRTDSPF)
|
||
|
command, and the Create Printer File (CRTPRTF) command, this program allows
|
||
|
you to add records to the physical file, display and update the records, and
|
||
|
print a report.</p>
|
||
|
<p>The program is written in Report Program Generator
|
||
|
(RPG). You can enter the RPG specifications shown in the example into a source
|
||
|
file on your system and create the program using the Create RPG Program (CRTRPGPGM)
|
||
|
command. For more information about RPG, see the <em>RPG/400<sup>®</sup> Reference</em> manual on the <a href="http://publib.boulder.ibm.com/iseries/v5r1/ic2924/rzaqhindex.htm" target="_blank">V5R1 Supplemental Manuals</a><img src="www.gif" alt="Link outside information center" /> Web site.</p>
|
||
|
<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>
|
||
|
<div class="fignone" id="physdispprintexamp__x24a"><a name="physdispprintexamp__x24a"><!-- --></a><span class="figcap">Figure 1. Example RPG program using a physical, display, and printer
|
||
|
file</span><br /><img src="rv2f513.gif" alt="An illustration of a coding
sheet that describes an RPG program that uses a physical, display, and printer
file" /><br /></div>
|
||
|
<div class="p"><strong>Legend: </strong> <dl><dt class="dlterm"><span>1</span></dt>
|
||
|
<dd>These are the file description specifications (F-specs) for the example
|
||
|
program. Positions 7 through 14 specify the file names. These file names
|
||
|
should be the same file names used when you created the files from the DDS
|
||
|
specifications earlier in this appendix.</dd>
|
||
|
<dt class="dlterm"><span>2</span></dt>
|
||
|
<dd>The Es in position 19 indicate that these files are externally described
|
||
|
(described in DDS specifications outside the program rather than
|
||
|
inside the program).</dd>
|
||
|
<dt class="dlterm"><span>3</span></dt>
|
||
|
<dd>These are the calculation specifications (C-specs).</dd>
|
||
|
<dt class="dlterm"><span>4</span></dt>
|
||
|
<dd>The first section of the C-specs displays a prompt and retrieves a record
|
||
|
from the database. <p>The TAG op code indicates a label in the program.
|
||
|
The EXFMT op code writes the record PROMPT to the display, then reads it when
|
||
|
the user presses the Enter key. The CHAIN op code retrieves a record from
|
||
|
CUSMST based on the key field ACTNUM. If no record with that key value is
|
||
|
found, indicator 30 is turned on. The program continues to prompt until the
|
||
|
key value of an existing record is entered in field ACTNUM (indicator 30 off)
|
||
|
or an A is entered in field ADD.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm"><span>5</span></dt>
|
||
|
<dd>This section adds a new record or updates an existing record in the database
|
||
|
file. <p>If a new customer is being added (indicator 30 is on), the WRITE
|
||
|
op code adds a new record to the physical file. Otherwise, the UPDAT op code
|
||
|
updates an existing record. The program continues to prompt for, retrieve,
|
||
|
add, and update records in the physical file until F3 is pressed, setting
|
||
|
on indicator 21.</p>
|
||
|
</dd>
|
||
|
<dt class="dlterm"><span>6</span></dt>
|
||
|
<dd>This section prints the report. <p>A record is read from the physical
|
||
|
file and the DETAIL record is written to the printer file until the end of
|
||
|
the physical file is reached (indicator 45 is set on). The HEADER record
|
||
|
is written on the first page and then written again on each new page (indicator
|
||
|
10 is on). When all the records have been written, the CLOSE op code closes
|
||
|
all the files and SETON LR ends the program.</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="examples.htm" title="These topics include a wide variety of examples that illustrate how you can use DDS.">Examples: DDS coding</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|