ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzakb_5.4.0.1/ldec.htm

139 lines
8.9 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="Decimal positions for physical and logical files (positions 36 and 37)" />
<meta name="abstract" content="Use these positions to specify the decimal placement within a packed decimal, zoned decimal, binary, or floating-point field." />
<meta name="description" content="Use these positions to specify the decimal placement within a packed decimal, zoned decimal, binary, or floating-point field." />
<meta name="DC.subject" content="decimal positions, logical files, decimal positions, physical files" />
<meta name="keywords" content="decimal positions, logical files, decimal positions, physical files" />
<meta name="DC.Relation" scheme="URI" content="rzakbmstlfpos.htm" />
<meta name="DC.Relation" scheme="URI" content="rzakbmstlfpos.htm" />
<meta name="DC.Relation" scheme="URI" content="rzakbmsttdjfld.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="ldec" />
<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>Decimal positions for physical and logical files (positions 36 and
37)</title>
</head>
<body id="ldec"><a name="ldec"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Decimal positions for physical and logical files (positions 36 and
37)</h1>
<div><p>Use these positions to specify the decimal placement within a packed
decimal, zoned decimal, binary, or floating-point field.</p>
<div class="section"><p>If you specify the CONCAT keyword for the field you are defining,
you cannot specify decimal positions. A field in the physical file that contains
decimal positions cannot be included in a concatenated field.</p>
<div class="note"><span class="notetitle">Note:</span> High-level
languages can impose specific length and value restrictions on the decimal
positions. Observe these restrictions for files used by those high-level languages.</div>
</div>
<div class="section"><h4 class="sectiontitle">Use decimal position with physical files</h4><p>For a physical
file, use these positions to specify the decimal placement within a packed
decimal, zoned decimal, binary, or floating-point field. Specify a decimal
number from 0 through 63 for the number of decimal positions to the right
of the decimal point. (The number must not be greater than the number of digits
specified in the field length.) The Positional entries for physical and logical
files (positions 1 through 44) topic shows how to code the decimal positions
field. If the field length is greater than 9 for a binary field, the decimal
positions value must be 0.</p>
<p>The data is actually stored in the system
without a decimal point. The decimal point is only implied. For example, the
value stored for 1.23 is 123. This is what appears in display or printer files
if editing is not specified.</p>
<p>To override the position of a referenced
field (R in position 29), specify either a new value or a change in position.
To increase the position, specify <em>+n</em>, where n is the amount of increase.
To decrease the position, specify <em>-n</em>, where <em>n</em> is the amount
of decrease. For example, an entry of +4 indicates that there are 4 more digits
to the right of the decimal point than were in the referenced field. An error
message is sent if the number of decimal positions is greater than the maximum
allowed.</p>
</div>
<div class="section"><h4 class="sectiontitle">Use decimal position with logical files</h4><p>For logical
files, specify decimal positions only to override or change the decimal positions
of the corresponding field in the physical file on which this logical file
is based. If you leave these positions blank, the field you are defining has
the same decimal positions as the corresponding field in the physical file
on which this logical file is based.</p>
<p>To override or change the placement
of the decimal point within a packed decimal or zoned decimal field, specify
a number from 0 through 63 to indicate the number of decimal positions to
the right of the decimal point. The number here must not be greater than the
number of digits specified in the field length. You cannot override or change
decimals when the corresponding field in the physical file is binary (data
type B) and contains decimal positions greater than zero. When the logical
file field is binary and the corresponding field in the physical file is not
binary (B specified in position 35 in the logical file), the decimal positions
must be zero for the binary field.</p>
<p>You can override the position of
the field by specifying a new value or by specifying an increase or decrease
in position. To increase the position, specify <em>+n</em>, where n is the amount
of increase. To decrease the position, specify <em>-n</em>, where n is the amount
of decrease. For example, an entry of +4 indicates that there
are 4 more digits to the right of the decimal point than were in the referenced
field.</p>
<div class="p">If you specify a value in positions 36 through 37 and your program
writes or retrieves data through the logical file field to the physical file
field, the operating system aligns the data on the decimal point. Depending
on the case, this can cause the decimal values to be truncated, or it can
cause a data conversion error. Decimal values are truncated in the following
cases: <ul><li>When reading from a logical file that reduces the number of decimal positions
specified in the physical file</li>
<li>When writing to a logical file that increases the number of decimal positions
specified in the physical file</li>
</ul>
</div>
<p>For example, if the physical file field is defined as 4 digits
long with 2 decimal positions, and the logical file field decreases the decimal
positions to 0 decimal positions, a value of 0.20 in the physical file becomes
a value of 0 in the logical file, and a value of 2.52 in the physical file
becomes a value of 2 in the logical file.</p>
<p>When decimal values are truncated,
the left side of the field is filled with zeros.</p>
<div class="p">A data conversion error
can occur in the following cases: <ul><li>When writing to a logical file that reduces the number of decimal positions
specified in the physical file</li>
<li>When reading from a logical file that increases the number of decimal
positions specified in the physical file</li>
</ul>
</div>
<p>The data conversion error occurs because too
many digits might be moved into the space available to the left of the decimal
point. For example, if, as in the previous example, the physical file field
is defined as 4 digits long with 2 decimal positions and the logical file
field decreases the decimal positions to 0 decimal positions, a value of 3322
written to the logical file cannot fit in the physical file. This value does
not fit because only 2 digits are allowed left of the decimal point in the
physical file.</p>
<p>To avoid data conversion errors, increase or decrease
the length (positions 30 through 34) of the logical file field by the same
amount that you increase or decrease the decimal positions.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzakbmstlfpos.htm" title="The first 44 positions of the DDS form are called positional entries.">Positional entries for physical and logical files (positions 1 through 44)</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rzakbmstlfpos.htm" title="The first 44 positions of the DDS form are called positional entries.">Positional entries for physical and logical files (positions 1 through 44)</a></div>
<div><a href="rzakbmsttdjfld.htm" title="Use this join-level keyword to identify the from and to fields whose values are used to join physical files in a join logical file. These fields are both referred to as join fields.">JFLD (Joined Fields) keyword—join logical files only</a></div>
</div>
</div>
</body>
</html>