<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.webhuis.nl:443/index.php?action=history&amp;feed=atom&amp;title=COBOL_Std_8_Data_Definition_Rules</id>
	<title>COBOL Std 8 Data Definition Rules - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.webhuis.nl:443/index.php?action=history&amp;feed=atom&amp;title=COBOL_Std_8_Data_Definition_Rules"/>
	<link rel="alternate" type="text/html" href="https://wiki.webhuis.nl:443/index.php?title=COBOL_Std_8_Data_Definition_Rules&amp;action=history"/>
	<updated>2026-09-11T06:39:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.webhuis.nl:443/index.php?title=COBOL_Std_8_Data_Definition_Rules&amp;diff=4725&amp;oldid=prev</id>
		<title>Martin: Created page with &quot;== 8. Data Definition Rules ==  === 8.1 Numeric Usage ===  * Signed arithmetic fields must use the S prefix: &lt;code&gt;PIC S9(9)&lt;/code&gt;. * Packed-decimal (COMP-3) is the preferred internal numeric type for arithmetic fields — smaller footprint and faster on most platforms. * Binary (COMP-5) for SQL Communications Area fields (SQLCODE etc.) to match GixSQL generated C types. * DISPLAY numeric only for print-output or host-variable character-format copybooks.  {| class=&quot;wiki...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.webhuis.nl:443/index.php?title=COBOL_Std_8_Data_Definition_Rules&amp;diff=4725&amp;oldid=prev"/>
		<updated>2026-03-25T11:17:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== 8. Data Definition Rules ==  === 8.1 Numeric Usage ===  * Signed arithmetic fields must use the S prefix: &amp;lt;code&amp;gt;PIC S9(9)&amp;lt;/code&amp;gt;. * Packed-decimal (COMP-3) is the preferred internal numeric type for arithmetic fields — smaller footprint and faster on most platforms. * Binary (COMP-5) for SQL Communications Area fields (SQLCODE etc.) to match GixSQL generated C types. * DISPLAY numeric only for print-output or host-variable character-format copybooks.  {| class=&amp;quot;wiki...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 8. Data Definition Rules ==&lt;br /&gt;
&lt;br /&gt;
=== 8.1 Numeric Usage ===&lt;br /&gt;
&lt;br /&gt;
* Signed arithmetic fields must use the S prefix: &amp;lt;code&amp;gt;PIC S9(9)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Packed-decimal (COMP-3) is the preferred internal numeric type for arithmetic fields — smaller footprint and faster on most platforms.&lt;br /&gt;
* Binary (COMP-5) for SQL Communications Area fields (SQLCODE etc.) to match GixSQL generated C types.&lt;br /&gt;
* DISPLAY numeric only for print-output or host-variable character-format copybooks.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
! Use Case !! Recommended PIC !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| Integer counter || &amp;lt;code&amp;gt;S9(9) COMP-3&amp;lt;/code&amp;gt; || Handles values to ±999,999,999.&lt;br /&gt;
|-&lt;br /&gt;
| Currency / amount || &amp;lt;code&amp;gt;S9(9)V99 COMP-3&amp;lt;/code&amp;gt; || Odd digit count for packed efficiency.&lt;br /&gt;
|-&lt;br /&gt;
| Square root / remainder || &amp;lt;code&amp;gt;9(9)V9(9) DISPLAY&amp;lt;/code&amp;gt; || 18-digit decimal for precision comparisons.&lt;br /&gt;
|-&lt;br /&gt;
| DB identity / sequence || &amp;lt;code&amp;gt;S9(9) COMP-3&amp;lt;/code&amp;gt; || Match PostgreSQL INTEGER type.&lt;br /&gt;
|-&lt;br /&gt;
| SQLCODE / SQLERRD || &amp;lt;code&amp;gt;S9(9) COMP-5&amp;lt;/code&amp;gt; || Required by GixSQL SQLCA layout.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== 8.2 88-Level Condition Names ===&lt;br /&gt;
&lt;br /&gt;
* Define 88-level conditions for every significant state a field can hold; never test magic numbers directly in procedural code.&lt;br /&gt;
* 88-level names must be self-documenting: &amp;lt;code&amp;gt;SW-END-OF-FILE&amp;lt;/code&amp;gt; rather than &amp;lt;code&amp;gt;SW-FLAG-1&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Comment the business meaning of each 88 at its definition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cobol&amp;quot;&amp;gt;&lt;br /&gt;
       03 DAL-RESULT            PIC 9(2) VALUE ZERO.&lt;br /&gt;
          *-- 0 = operation succeeded&lt;br /&gt;
          88 DAL-METHOD-OK      VALUE 0.&lt;br /&gt;
          *-- 1 = operation failed; caller should log and stop&lt;br /&gt;
          88 DAL-METHOD-NOK     VALUE 1.&lt;br /&gt;
          *-- 2 = end of data / not found; not an error&lt;br /&gt;
          88 DAL-METHOD-EOF     VALUE 2.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 8.3 Host Variable Copybooks ===&lt;br /&gt;
&lt;br /&gt;
* SQL host variables must be defined in a dedicated copybook (suffix &amp;lt;code&amp;gt;-TAB&amp;lt;/code&amp;gt;) included via &amp;lt;code&amp;gt;EXEC SQL INCLUDE&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Do not define host variables inline in WORKING-STORAGE outside a designated include.&lt;br /&gt;
* Character-format and packed-decimal versions are separate copybooks if both are needed; name them unambiguously (e.g. &amp;lt;code&amp;gt;PRIMES-TAB-PKD.cpy&amp;lt;/code&amp;gt; vs &amp;lt;code&amp;gt;PRIMES-TAB.cpy&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&amp;#039;&amp;#039;[[Cobol programming standards|← Back to index]]&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>Martin</name></author>
	</entry>
</feed>