ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbp_5.4.0.1/rbafocrref.htm

207 lines
13 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="Use existing field descriptions and field reference files to describe a database file" />
<meta name="abstract" content="If a field was already described in an existing file, and you want to use that field description in a new file you are setting up, you can request the system to copy that description into your new file description." />
<meta name="description" content="If a field was already described in an existing file, and you want to use that field description in a new file you are setting up, you can request the system to copy that description into your new file description." />
<meta name="DC.subject" content="field, using, existing descriptions and reference files, description, using existing field, physical file, existing field descriptions, physical file, field reference, determining, existing record formats, REF (Reference) keyword, Reference (REF) keyword, keyword, DDS, REF (Reference), REFFLD (Referenced Field) keyword, Referenced Field (REFFLD) keyword, REFFLD (Referenced Field)" />
<meta name="keywords" content="field, using, existing descriptions and reference files, description, using existing field, physical file, existing field descriptions, physical file, field reference, determining, existing record formats, REF (Reference) keyword, Reference (REF) keyword, keyword, DDS, REF (Reference), REFFLD (Referenced Field) keyword, Referenced Field (REFFLD) keyword, REFFLD (Referenced Field)" />
<meta name="DC.Relation" scheme="URI" content="rbafodescdds.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="rbafocrref" />
<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>Use existing field descriptions and field reference files
to describe a database file</title>
</head>
<body id="rbafocrref"><a name="rbafocrref"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use existing field descriptions and field reference files
to describe a database file</h1>
<div><p>If a field was already described in an existing file, and you want
to use that field description in a new file you are setting up, you can request
the system to copy that description into your new file description.</p>
<p>DDS keywords REF and REFFLD allow you to refer to a field description in
an existing file. This helps reduce the effort of coding DDS statements. It
also helps ensure that the field attributes are used consistently in all files
that use the field.</p>
<p>In
addition, you can create a physical file for the sole purpose of using its
field descriptions. That is, the file does not contain data; it is used only
as a reference for the field descriptions for other files. This type of file
is known as a field reference file. A <em>field reference file</em> is a physical
file containing no data, just field descriptions.</p>
<p>You can use a field reference file to simplify record format descriptions
and to ensure that field descriptions are used consistently. You can define
all the fields you need for an application or any group of files in a field
reference file. You can create a field reference file using DDS and the Create
Physical File (CRTPF) command.</p>
<p>After the field reference file is created, you can build physical file
record formats from this file without describing the characteristics of each
field in each file. When you build physical files, all you need to do is to
refer to the field reference file (using the REF and REFFLD keywords) and
specify any changes. Any changes to the field descriptions and keywords specified
in your new file override the descriptions in the field reference file.</p>
<p>In the following example, a field reference file named DSTREFP is created
for distribution applications. The following example shows the DDS needed
to describe DSTREFP.</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A* FIELD REFERENCE FILE (DSTREFP)
A R DSTREF TEXT('Field reference file')
A
A* FIELDS DEFINED BY CUSTOMER MASTER RECORD (CUSMST)
A CUST 5 0 TEXT('Customer numbers')
A COLHDG('CUSTOMER' 'NUMBER')
A NAME 20 TEXT('Customer name')
A ADDR 20 TEXT('Customer address')
A
A CITY 20 TEXT('Customer city')
A
A STATE 2 TEXT('State abbreviation')
A CHECK(MF)
A CRECHK 1 TEXT('Credit check')
A VALUES('Y' 'N')
A SEARCH 6 0 TEXT('Customer name search')
A COLHDG('SEARCH CODE')
A ZIP 5 0 TEXT('Zip code')
A CHECK(MF)
A CUTYPE 15 COLHDG('CUSTOMER' 'TYPE')
A RANGE(1 5)
A
A* FIELDS DEFINED BY ITEM MASTER RECORD (ITMAST)
A ITEM 5 TEXT('Item number')
A COLHDG('ITEM' 'NUMBER')
A CHECK(M10)
A DESCRP 18 TEXT('Item description')
A PRICE 5 2 TEXT('Price per unit')
A EDTCDE(J)
A CMP(GT 0)
A COLHDG('PRICE')
A ONHAND 5 0 TEXT('On hand quantity')
A EDTCDE(Z)
A CMP(GE 0)
A COLHDG('ON HAND')
A WHSLOC 3 TEXT('Warehouse location')
A CHECK(MF)
A COLHDG('BIN NO')
A ALLOC R REFFLD(ONHAND *SRC)
A TEXT('Allocated quantity')
A CMP(GE 0)
A COLHDG('ALLOCATED')
A
A* FIELDS DEFINED BY ORDER HEADER RECORD (ORDHDR)
A ORDER 5 0 TEXT('Order number')
A COLHDG('ORDER' 'NUMBER')
A ORDATE 6 0 TEXT('Order date')
A EDTCDE(Y)
A COLHDG('DATE' 'ORDERED')
A CUSORD 15 TEXT('Cust purchase ord no.')
A COLHDG('P.O.' 'NUMBER')
A SHPVIA 15 TEXT('Shipping instructions')
A ORDSTS 1 TEXT('Order status code')
A COLHDG('ORDER' 'STATUS')
A OPRNME R REFFLD(NAME *SRC)
A TEXT('Operator name')
A COLHDG('OPERATOR NAME')
A ORDAMT 9 2 TEXT('Total order value')
A COLHDG('ORDER' 'AMOUNT')
A INVNBR 5 0 TEXT('Invoice number')
A COLHDG('INVOICE' 'NUMBER')
A PRTDAT 6 0 EDTCDE(Y)
A COLHDG('PRINTED' 'DATE')
A SEQNBR 5 0 TEXT('Sequence number')
A COLHDG('SEQ' 'NUMBER')
A OPNSTS 1 TEXT('Open status')
A COLHDG('OPEN' 'STATUS')
A LINES 3 0 TEXT('Lines on invoice')
A COLHDG('TOTAL' 'LINES')
A ACTMTH 2 0 TEXT('Accounting month')
A COLHDG('ACCT' 'MONTH')
A ACTYR 2 0 TEXT('Accounting year')
A COLHDG('ACCT' 'YEAR')
A
A* FIELDS DEFINED BY ORDER DETAIL/LINE ITEM RECORD (ORDDTL)
A LINE 3 0 TEXT('Line no. this item')
A COLHDG('LINE' 'NO')
A QTYORD 3 0 TEXT('Quantity ordered')
A COLHDG('QTY' 'ORDERED'
A CMP(GE 0)
A EXTENS 6 2 TEXT('Ext of QTYORD x PRICE')
A EDTCDE(J)
A COLHDG('EXTENSION')
A
A* FIELDS DEFINED BY ACCOUNTS RECEIVABLE
A ARBAL 8 2 TEXT('A/R balance due')
A EDTCDE(J)
A
A* WORK AREAS AND OTHER FIELDS THAT OCCUR IN MULTIPLE PROGRAMS
A STATUS 12 TEXT('status description')
A A</pre>
<div class="p">Assume that the DDS in the previous example is entered into a source file
FRSOURCE; the member name is DSTREFP. To create a field reference file, use
the CRTPF command as follows:<pre>CRTPF FILE(DSTPRODLB/DSTREFP)
SRCFILE(QGPL/FRSOURCE) MBR(*NONE)
TEXT('Distribution field reference file')</pre>
</div>
<p>The parameter MBR(*NONE) tells the system not to add a member to the file
(because the field reference file never contains data and therefore does not
need a member).</p>
<p>To describe the physical file ORDHDRP by referring to DSTREFP, use the
following DDS example:</p>
<pre>|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A* ORDER HEADER FILE (ORDHDRP) - PHYSICAL FILE RECORD DEFINITION
A REF(DSTREFP)
A R ORDHDR TEXT('Order header record')
A CUST R
A ORDER R
A ORDATE R
A CUSORD R
A SHPVIA R
A ORDSTS R
A OPRNME R
A ORDAMT R
A CUTYPE R
A INVNBR R
A PRTDAT R
A SEQNBR R
A OPNSTS R
A LINES R
A ACTMTH R
A ACTYR R
A STATE R
A</pre>
<p>The REF keyword (positions 45 through 80) with DSTREFP (the field reference
file name) specified indicates the file from which field descriptions are
to be used. The R in position 29 of each field indicates that the field description
is to be taken from the reference file.</p>
<div class="p">When you create the ORDHDRP file, the system uses the DSTREFP file to determine
the attributes of the fields included in the ORDHDR record format. To create
the ORDHDRP file, use the CRTPF command. Assume that the DDS in the previous
example was entered into a source file QDDSSRC; the member name is ORDHDRP. <pre> CRTPF FILE(DSTPRODLB/ORDHDRP)
TEXT('Order Header physical file')</pre>
<div class="note"><span class="notetitle">Note:</span> The files used
in some of the examples in this topic collection refer to this field reference
file.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodescdds.htm" title="When you describe a database file using data description specifications (DDS), you can describe information at the file, record-format, join, field, key, and select/omit levels.">Describe database files using DDS</a></div>
</div>
</div>
</body>
</html>