<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mainframe is Back &#187; COBOL</title>
	<atom:link href="http://www.ibmmainframe.cn/tag/cobol/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ibmmainframe.cn</link>
	<description>Everything about Mainframe: 中文大型机资讯网</description>
	<lastBuildDate>Sun, 25 Sep 2011 16:32:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The 1st Day of Learning Cobol</title>
		<link>http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/</link>
		<comments>http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 03:05:17 +0000</pubDate>
		<dc:creator>Raymond</dc:creator>
				<category><![CDATA[COBOL]]></category>

		<guid isPermaLink="false">http://www.ibmmainframe.cn/2007/11/21/the-1st-day-of-learning-cobol/</guid>
		<description><![CDATA[首先，Cobol是什么？Cobol是Common Business Oriented Language的缩写。与Java,C++这样的OO语言相比，主要的作用是用于处理大批量的记录。现在主要应用与大型机和小型机上面。 Cobol中主要分为四个DIVISION分别是： 1.IDENTIFICATION DIVISION 2.ENVIRONMENT DIVISION 3.DATA DIVISION 4.PROCEDURE DIVISION 下面是一个最简单的Cobol程序，用于输出”Hello World”: IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. PROCEDURE DIVISION. DISPLAYHELLO. DISPLAY “HELLO WORLD”. STOP RUN. 该程序在大机上为： 相关文章The Four DivisionsCOBOL basicsIntroduction to ProgrammingCOBOL Overview]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>首先，Cobol是什么？Cobol是Common Business Oriented Language的缩写。与Java,C++这样的OO语言相比，主要的作用是用于处理大批量的记录。现在主要应用与大型机和小型机上面。</p>
<p>Cobol中主要分为四个DIVISION分别是：</p>
<p>1.IDENTIFICATION DIVISION<br />
2.ENVIRONMENT DIVISION<br />
3.DATA DIVISION<br />
4.PROCEDURE DIVISION<br />
下面是一个最简单的Cobol程序，用于输出”Hello World”:<br />
IDENTIFICATION DIVISION.<br />
PROGRAM-ID. HELLO.<br />
PROCEDURE DIVISION.<br />
DISPLAYHELLO.<br />
DISPLAY “HELLO WORLD”.<br />
STOP RUN.</p>
<p>该程序在大机上为：</p>
<table>
<tbody>
<tr>
<td><a title="photo1.GIF" href="http://www.ibmmainframe.cn/wp-content/uploads/2007/11/photo1.GIF"><img class="alignnone" src="http://www.ibmmainframe.cn/wp-content/uploads/2007/11/photo1.thumbnail.GIF" alt="photo1.GIF" width="191" height="150" /></p>
<p></a></td>
</tr>
</tbody>
</table>
<div class="shr-publisher-149"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.ibmmainframe.cn/2007/01/the-four-divisions/" title="The Four Divisions">The Four Divisions</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-basics/" title="COBOL basics">COBOL basics</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/introduction-to-programming/" title="Introduction to Programming">Introduction to Programming</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-overview/" title="COBOL Overview">COBOL Overview</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Four Divisions</title>
		<link>http://www.ibmmainframe.cn/2007/01/the-four-divisions/</link>
		<comments>http://www.ibmmainframe.cn/2007/01/the-four-divisions/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 14:38:00 +0000</pubDate>
		<dc:creator>billrain</dc:creator>
				<category><![CDATA[COBOL]]></category>

		<guid isPermaLink="false">http://www.ibmmainframe.cn/2007/01/09/the-four-divisions/</guid>
		<description><![CDATA[The Four Divisions Introduction At the top of the COBOL hierarchy are the four divisions. These divide the program into distinct structural elements. Although some of the divisions may be omitted, the sequence in which they are specified is fixed, and must follow the order below. IDENTIFICATION DIVISION. Contains program information ENVIRONMENT DIVISION. Contains environment<a href="http://www.ibmmainframe.cn/2007/01/the-four-divisions/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><table style="text-align: left; margin-left: 0pt; margin-right: 0pt; height: 3190px;" border="0" cellspacing="0" cellpadding="4" width="644">
<tbody>
<tr>
<td style="color: #993300;" colspan="3" align="left" valign="top">
<h2><span style="color: #ffff00;"><span style="font-family: Arial,Helvetica,sans-serif;">The                Four Divisions</span></span></h2>
</td>
<td style="vertical-align: top;"><span id="more-20"></span><!--more--></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="374" align="left" valign="top">
<h4><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;">Introduction</span></h4>
</td>
<td width="500" height="374" valign="top">
<p style="text-align: justify;">
<p>At the top of the COBOL hierarchy are the four divisions. These                divide the program into distinct structural elements. Although some                of the divisions may be omitted, the sequence in which they are                specified is fixed, and must follow the order below.</p>
<blockquote>
<blockquote>
<blockquote><p><strong><span style="font-family: Arial,Helvetica,sans-serif; font-size: 78%;">IDENTIFICATION                      DIVISION.</span></strong><br />
Contains program information</p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><strong><span style="font-size: 78%;">ENVIRONMENT                      DIVISION.</span></strong></span><br />
Contains environment information</p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><strong><span style="font-size: 78%;">DATA                      DIVISION.</span></strong></span><br />
Contains data descriptions</p>
<p><strong><span style="font-family: Arial,Helvetica,sans-serif; font-size: 78%;">PROCEDURE                      DIVISION.</span></strong><br />
Contains the program algorithms</p></blockquote>
</blockquote>
</blockquote>
<hr size="1" /></td>
<td style="vertical-align: top;"></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="710" align="left" valign="top">
<h4><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;">The                IDENTIFICATION DIVISION</span></h4>
</td>
<td width="525" height="710" valign="top">
<p style="text-align: justify;">The <span>IDENTIFICATION DIVISION</span> supplies information                about the program to the programmer and the compiler.</p>
<p>Most entries in the <span>IDENTIFICATION DIVISION </span>are                directed at the programmer. The compiler treats them as comments.</p>
<p>The <span>PROGRAM-ID</span> clause is an exception to                this rule. Every COBOL program must have a <span>PROGRAM-ID</span> because the name specified after this clause is used by the linker                when linking a number of subprograms into one run unit, and by the                <span>CALL</span> statement when transferring control                to a subprogram.</p>
<p>The <span>IDENTIFICATION DIVISION </span>has the following                structure:</p>
<blockquote><p><span style="font-family: Courier New,Courier,mono;"><strong>IDENTIFICATION DIVISION<br />
PROGRAM-ID. NameOfProgram.<br />
[AUTHOR. YourName.]<br />
other entries here</strong></span></p></blockquote>
<p>The keywords &#8211; <span>IDENTIFICATION DIVISION</span> &#8211;                represent the division header, and signal the commencement of the                program text.</p>
<p><span>PROGRAM-ID</span> is a paragraph name that must                be specified immediately after the division header.</p>
<p>NameOfProgram is a name devised by the programmer, and must satisfy                the rules for user-defined names.</p>
<p>Here&#8217;s a typical program fragment:</p>
<table border="1" cellpadding="5" width="374" align="center">
<tbody>
<tr>
<td>
<pre><strong><span style="font-family: Courier New,Courier,mono;">IDENTIFICATION DIVISION.PROGRAM-ID. SequenceProgram.AUTHOR. Michael Coughlan.</span></strong></pre>
</td>
</tr>
</tbody>
</table>
<hr size="1" /></td>
<td style="vertical-align: top;"></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="288" align="left" valign="top">
<h4><span style="color: #800000;"><strong><span style="font-family: Arial,Helvetica,sans-serif;">The                ENVIRONMENT DIVISION</span></strong></span></h4>
</td>
<td width="525" height="288" valign="top">The <span>ENVIRONMENT DIVISION</span> is used to describe                the environment in which the program will run.</p>
<p>The purpose of the <span>ENVIRONMENT DIVISION</span> is to isolate in one place all aspects of the program that are dependant                upon a specific computer, device or encoding sequence.</p>
<p>The idea behind this is to make it easy to change the program                when it has to run on a different computer or one with different                peripheral devices.</p>
<p>In the <span>ENVIRONMENT DIVISION</span>, aliases are                assigned to external devices, files or command sequences. Other                environment details, such as the collating sequence, the currency                symbol and the decimal point symbol may also be defined here.</p>
<hr size="1" /></td>
<td style="vertical-align: top;"></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="825" align="left" valign="top">
<div><span style="color: #800000;"><strong><span style="font-family: Arial,Helvetica,sans-serif;">The                DATA DIVISION</span></strong></span></div>
</td>
<td width="525" height="825" valign="top">As the name suggests, the <span>DATA DIVISION</span> provides descriptions of the data-items processed by the program.</p>
<p>The <span>DATA DIVISION</span> has two main sections:                the <span>FILE SECTION</span> and the <span>WORKING-STORAGE                SECTION</span>. Additional sections, such as the <span>LINKAGE                SECTION</span> (used in subprograms) and the <span>REPORT                SECTION</span> (used in Report Writer based programs) may also be                required.</p>
<p>The <span>FILE SECTION</span> is used to describe most                of the data that is sent to, or comes from, the computer&#8217;s peripherals.</p>
<p>The <span>WORKING-STORAGE SECTION</span> is used to describe                the general variables used in the program.</p>
<p>The <span>DATA DIVISION</span> has the following structure                and syntax:</p>
<p><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/DataDiv.gif" alt="" width="332" height="161" /></p>
<p>Below is a sample program fragment -</p>
<table border="1" cellpadding="5" width="406" align="center">
<tbody>
<tr>
<td>
<pre><span style="font-family: Courier New,Courier,mono;">IDENTIFICATION DIVISION.PROGRAM-ID. SequenceProgram.AUTHOR. Michael Coughlan.</span><strong><span style="font-family: Courier New,Courier,mono;">DATA DIVISION.WORKING-STORAGE SECTION.01  Num1           PIC 9  VALUE ZEROS.01  Num2           PIC 9  VALUE ZEROS.01  Result         PIC 99 VALUE ZEROS.</span></strong></pre>
</td>
</tr>
</tbody>
</table>
<hr size="1" /></td>
<td style="vertical-align: top;"></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="69" align="left" valign="top">
<h4><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;">The                PROCEDURE DIVISION</span></h4>
</td>
<td width="525" height="69" valign="top">The <span>PROCEDURE DIVISION</span> contains the code                used to manipulate the data described in the <span>DATA                DIVISION</span>. It is here that the programmer describes his algorithm.</p>
<p>The <span>PROCEDURE DIVISION</span> is hierarchical in                structure and consists of sections, paragraphs, sentences and statements.</p>
<p>Only the section is optional. There must be at least one paragraph,                sentence and statement in the <span>PROCEDURE DIVISION</span>.</p>
<p>Paragraph and section names in the <span>PROCEDURE DIVISION</span> are chosen by the programmer and must conform to the rules for user-defined                names.</p>
<p><strong>Sample Program</strong></p>
<table border="1" cellpadding="5" width="390" align="center">
<tbody>
<tr>
<td>
<pre><span style="font-family: Courier New,Courier,mono;">IDENTIFICATION DIVISION.PROGRAM-ID. SequenceProgram.AUTHOR. Michael Coughlan. </span></pre>
<pre><span style="font-family: Courier New,Courier,mono;">DATA DIVISION.WORKING-STORAGE SECTION.01 Num1 PIC 9 VALUE ZEROS.01 Num2 PIC 9 VALUE ZEROS.01 Result PIC 99 VALUE ZEROS.</span></pre>
<pre><strong><span style="font-family: Courier New,Courier,mono;">PROCEDURE DIVISION.CalculateResult.ACCEPT Num1.ACCEPT Num2.MULTIPLY Num1 BY Num2 GIVING Result.DISPLAY "Result is = ", Result.STOP RUN.</span></strong></pre>
</td>
</tr>
</tbody>
</table>
<p>Some COBOL compilers require that all the divisions be present                in a program while others only require the <span>IDENTIFICATION                DIVISION</span> and the <span>PROCEDURE DIVISION</span>.                For instance the program shown below is perfectly valid when compiled                with the Microfocus NetExpress compiler.</p>
<p><strong>Minimum COBOL program</strong></p>
<table border="1" cellpadding="5" width="390" align="center">
<tbody>
<tr>
<td height="130">
<pre><strong>IDENTIFICATION DIVISION.PROGRAM-ID.  SmallestProgram.</strong></pre>
<pre><strong>PROCEDURE DIVISION.DisplayGreeting.DISPLAY "Hello world".STOP RUN.</strong></pre>
</td>
</tr>
</tbody>
</table>
</td>
<td style="vertical-align: top;"></td>
</tr>
</tbody>
</table>
<div class="shr-publisher-20"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/" title="The 1st Day of Learning Cobol">The 1st Day of Learning Cobol</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-basics/" title="COBOL basics">COBOL basics</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/introduction-to-programming/" title="Introduction to Programming">Introduction to Programming</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-overview/" title="COBOL Overview">COBOL Overview</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ibmmainframe.cn/2007/01/the-four-divisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>COBOL basics</title>
		<link>http://www.ibmmainframe.cn/2007/01/cobol-basics/</link>
		<comments>http://www.ibmmainframe.cn/2007/01/cobol-basics/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 14:37:00 +0000</pubDate>
		<dc:creator>billrain</dc:creator>
				<category><![CDATA[COBOL]]></category>

		<guid isPermaLink="false">http://www.ibmmainframe.cn/2007/01/09/cobol-basics/</guid>
		<description><![CDATA[COBOL basics Introduction This section presents the fundamentals of constructing COBOL programs. It explains the notation used in COBOL syntax diagrams and enumerates the COBOL coding rules. It shows how user-defined names are constructed and examines the structure of COBOL programs. COBOL idiosyncrasies COBOL is one of the oldest programming languages in use. As a<a href="http://www.ibmmainframe.cn/2007/01/cobol-basics/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><table border="0" cellpadding="4" cellspacing="0" width="710">
<tbody>
<tr>
<td colspan="3" style="color:rgb(153, 51, 0);" align="left" valign="top">
<h2 align="center"><span style="color:rgb(255, 255, 0);"><span style="font-family:Arial,Helvetica,sans-serif;">COBOL                basics </span></span></h2>
</td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="119" valign="top" width="175">
<h4><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">Introduction</span></h4>
<h4> </h4>
</td>
<td style="vertical-align:top;"></td>
<td height="119" valign="top" width="525">
<p>This section presents the fundamentals of constructing COBOL programs.                It explains the notation used in COBOL syntax diagrams and enumerates                the COBOL coding rules. It shows how user-defined names are constructed                and examines the structure of COBOL programs.           </p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="406" valign="top" width="175">
<h4 align="left"><b><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">COBOL                idiosyncrasies</span> </b></h4>
</td>
<td style="vertical-align:top;"></td>
<td height="406" valign="top" width="525">
<p>COBOL is one of the oldest programming languages in use. As a result                it has some idiosyncrasies which programmers used to other languages                may find irritating. </p>
<p>When COBOL was developed (around the end of the 1950&#8242;s) one of                the design goals was to make it as English-like as possible. As                a result, COBOL uses structural concepts normally associated with                English prose such as section, paragraph and sentence. It also has                an extensive reserved word list with over 300 entries and the reserved                words themselves, tend to be long. COBOL programs tend to be verbose                especially when compared to languages like C.</p>
<p>When COBOL was designed, programs were written on coding forms                (see below) , punched on to punch cards, and loaded into the computer                using a punch card reader. These media (coding forms and punch cards)                required adherence to a number formatting restrictions that some                COBOL implementations still enforce today, long after the need for                them has gone.</p>
<p>Although modern COBOL (COBOL 85 and OO-COBOL) has introduced many                of the constructs required to write well structured programs it                also still retains elements which, if used, make it difficult, and                in some cases impossible, to write good programs. </p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="404" valign="top" width="175">
<h4><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">COBOL                syntax </span></h4>
</td>
<td style="vertical-align:top;"></td>
<td height="404" valign="top" width="525">
<p>COBOL syntax is defined using particular notation sometimes called                the COBOL MetaLanguage. </p>
<p>In this notation, words in uppercase are reserved words. When underlined                they are mandatory. When not underlined they are “noise”                words, used for readability only, and are optional. Because COBOL                statements are supposed to read like English sentences there are                a lot of these “noise” words.</p>
<p>Words in mixed case represent names that must be devised by the                programmer (like data item names). </p>
<p>When material is enclosed in curly braces <b>{ }</b>, a choice                must be made from the options within the braces. If there is only                one option then that item in mandatory.</p>
<p>Material enclosed in square brackets <b>[ ]</b>, indicates that                the material is optional, and may be included or omitted as required.              </p>
<p>The ellipsis symbol <b>&#8230;</b> (three dots), indicates that the                preceding syntax element may be repeated at the programmer&#8217;s discretion.</p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="273" valign="top" width="175">
<h4><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">Some                notes on syntax diagrams</span></h4>
<h4> </h4>
</td>
<td style="vertical-align:top;"></td>
<td height="273" valign="top" width="525">
<p>To simplify the syntax diagrams and reduce the number of rules                that must be explained, in some diagrams special operand endings                have been used (note that this is my own extension &#8211; it is not standard                COBOL).           </p>
<p> These special operand endings have the following meanings:</p>
<blockquote><table border="1" cellpadding="5" cellspacing="1" width="100%">
<tbody>
<tr>
<td><b><span style="font-family:Arial,Helvetica,sans-serif;">$i </span></b></td>
<td><span style="font-family:Arial,Helvetica,sans-serif;">uses an alphanumeric                      data-item</span></td>
</tr>
<tr>
<td><b><span style="font-family:Arial,Helvetica,sans-serif;">$il</span></b></td>
<td><span style="font-family:Arial,Helvetica,sans-serif;">uses an alphanumeric                      data-item or a string literal</span></td>
</tr>
<tr>
<td><b><span style="font-family:Arial,Helvetica,sans-serif;">#i</span></b></td>
<td><span style="font-family:Arial,Helvetica,sans-serif;">uses a numeric                      data-item</span></td>
</tr>
<tr>
<td><b><span style="font-family:Arial,Helvetica,sans-serif;">#il </span></b></td>
<td><span style="font-family:Arial,Helvetica,sans-serif;">uses a numeric                      data-item or numeric literal </span></td>
</tr>
<tr>
<td><b><span style="font-family:Arial,Helvetica,sans-serif;">$#i</span></b></td>
<td><span style="font-family:Arial,Helvetica,sans-serif;">uses a numeric                      or an alphanumeric data-item</span></td>
</tr>
</tbody>
</table>
</blockquote>
</td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="663" valign="top" width="175">
<h4><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">An example                syntax diagram</span></h4>
<h4> </h4>
<h4> </h4>
<h4>  </h4>
<h4> </h4>
<h4> </h4>
<h4> </h4>
<h4> </h4>
<h4> </h4>
<div align="center"><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/i-Detail.gif" height="37" width="30" /><br />             <span>Note that for clarity data items may be separated                from one another by means of an optional comma.<br />             This has been done in the COMPUTE statement opposite</span></div>
<h4> </h4>
<h4 align="center"> </h4>
</td>
<td style="vertical-align:top;"></td>
<td height="663" valign="top" width="525">
<p>In COBOL, evaluating an arithmetic expression and assigning the                result to a data item is achieved by means of the COMPUTE statement.                The syntax diagram for the COMPUTE is shown below.</p>
<p align="center"><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/Compute.gif" height="77" width="509" /></p>
<p>This syntax diagram may be interpreted as follows; </p>
<p>We must start a <span>COMPUTE</span> statement with the                keyword <span>COMPUTE</span>. </p>
<p>We must follow the keyword with the name(s) of the numeric data                item (or items &#8211; note the ellipsis symbol (&#8230;)) to be used to receive                the result of the expression. The #i suffix at the end of word <b>Result</b>                tells us that a numeric identifier/data item must be used.</p>
<p align="left">Since the ellipsis symbol is placed outside the curly                brackets we can interpret this to mean that each result field can                have its own <span>ROUNDED</span> phase. In other words                we could have a <span>COMPUTE</span> statement like -</p>
<p>             <b><span style="font-family:Courier New,Courier,mono;">COMPUTE Result1 ROUNDED,                Result2 = ((9*9)+8)/5</span></b></p>
<p align="left">where Result1 would be assigned a value of 18 and                Result2 would be assigned a value of 17.8.</p>
<p align="left">The square brackets after the Arithmetic Expression                indicate that the next items are optional but if used we must choose                between the <span>ON SIZE ERROR</span> or <span>NOT                ON SIZE ERROR</span> phrases.</p>
<p align="left">Because the <span>END-COMPUTE</span> is                contained within the square brackets it must only be used when a                <span>SIZE ERROR</span> or <span>NOT SIZE ERROR</span>                phrase is used.</p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="907" valign="top" width="175">
<h4><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;"><b>COBOL                coding rules</b></span></h4>
</td>
<td style="vertical-align:top;"></td>
<td height="907" valign="top" width="525">
<p>Traditionally, COBOL programs were written on coding forms and                then punched on to punch cards. Although nowadays most programs                are entered directly into a computer, some COBOL formatting conventions                remain that derive from its ancient punch-card history.</p>
<p>On coding forms, the first six character positions are reserved                for sequence numbers. The seventh character position is reserved                for the continuation character, or for an asterisk that denotes                a comment line. </p>
<p>The actual program text starts in column 8. The four positions                from 8 to 11 are known as Area A, and positions from 12 to 72 are                Area B.           </p>
<p>Although many COBOL compilers ignore some of these formatting restrictions,                most still retain the distinction between Area A and Area B. </p>
<p>When a COBOL compiler recognizes the two areas, all division names,                section names, paragraph names, FD entries and 01 level numbers                must start in Area A. All other sentences must start in Area B.</p>
<p>In our example programs we use the compiler directive (available                with the NetExpress COBOL compiler) &#8211; <span>$ SET SOURCEFORMAT”FREE”</span>                &#8211; to free us from these formatting restrictions.           </p>
<p align="center"><b>Ancient COBOL coding form</b><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/CodingForm.jpg" border="1" height="415" width="498" /></p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="238" valign="top" width="175">
<h4><b><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">Name                construction</span></b></h4>
</td>
<td style="vertical-align:top;"></td>
<td height="238" valign="top" width="525">
<p>All user-defined names, such as data names, paragraph names, section                names condition names and mnemonic names, must adhere to the following                rules:</p>
<ol>
<li>They must contain at least one character, but not more than                  30 characters.</li>
<li>They must contain at least one alphabetic character.</li>
<li>They must not begin or end with a hyphen.</li>
<li>They must be constructed from the characters A to Z, the numbers                  0 to 9, and the hyphen.</li>
<li>They must not contain spaces.</li>
<li>Names are not case-sensitive: TotalPay is the same as totalpay,                  Totalpay or <span>TOTALPAY</span>.             </li>
</ol>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td style="color:rgb(255, 255, 204);" align="left" height="502" valign="top" width="175">
<h4><span style="color:rgb(128, 0, 0);font-family:Arial,Helvetica,sans-serif;">The                structure of COBOL programs</span></h4>
<h4 align="center"> </h4>
<h4 align="center"> </h4>
<h4 align="center"> </h4>
<h4 align="center"> </h4>
<h4 align="center"> </h4>
</td>
<td style="vertical-align:top;"></td>
<td height="502" valign="top" width="525">
<p>COBOL programs are hierarchical in structure. Each element of the                hierarchy consists of one or more subordinate elements. </p>
<p>The hierarchy consists of Divisions, Sections, Paragraphs, Sentences                and Statements. </p>
<p>A Division may contain one or more Sections, a Section one or more                Paragraphs, a Paragraph one or more Sentences and a Sentence one                or more Statements. </p>
<p>We can represent the COBOL hierarchy using the COBOL metalanguage                as follows;</p>
</p>
<p align="center"> <img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/CobolStructure.gif" height="203" width="467" />           </p>
<p align="center">
<p align="left"><b><span style="font-family:Arial,Helvetica,sans-serif;">Divisions</span></b><br />             A division is a block of code, usually containing one or more sections,                that starts where the division name is encountered and ends with                the beginning of the next division or with the end of the program                text. </p>
<p align="left">             <b><span style="font-family:Arial,Helvetica,sans-serif;">Sections</span></b><br />             A section is a block of code usually containing one or more paragraphs.                A section begins with the section name and ends where the next section                name is encountered or where the program text ends. </p>
<p align="left">Section names are devised by the programmer, or defined                by the language. A section name is followed by the word <span>SECTION</span>                and a period.<br />             See the two example names below -</p>
<blockquote><p> <b><span style="font-family:Courier New,Courier,mono;">SelectUnpaidBills                  SECTION.<br />               </span></b><span style="font-family:Courier New,Courier,mono;"><b>FILE SECTION.</b></span></p>
</p>
</blockquote>
<p><span style="font-family:Arial,Helvetica,sans-serif;"><b>Paragraphs</b></span><br />             A paragraph is a block of code made up of one or more sentences.                A paragraph begins with the paragraph name and ends with the next                paragraph or section name or the end of the program text. </p>
<p>A paragraph name is devised by the programmer or defined by the                language, and is followed by a period.<br />             See the two example names below -</p>
<blockquote><p><span style="font-family:Courier New,Courier,mono;"><b>PrintFinalTotals.<br />               </b></span><span style="font-family:Courier New,Courier,mono;"><b>PROGRAM-ID.</b></span>             </p>
</p>
</blockquote>
<p><span style="font-family:Arial,Helvetica,sans-serif;"><b>Sentences and statements</b></span><br />             A sentence consists of one or more statements and is terminated                by a period.<br />             For example:</p>
<blockquote><p><b><span style="font-family:Courier New,Courier,mono;">MOVE .21 TO VatRate<br />                  MOVE 1235.76 TO ProductCost<br />                  COMPUTE VatAmount = ProductCost * VatRate.</span></b></p>
</blockquote>
<p>             A statement consists of a COBOL verb and an operand or operands.              <br />             For example:</p>
<blockquote><p><b><span style="font-family:Courier New,Courier,mono;">SUBTRACT Tax FROM                  GrossPay GIVING NetPay</span></b></p>
</blockquote>
</td>
</tr>
</tbody>
</table>
<div class="shr-publisher-19"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/" title="The 1st Day of Learning Cobol">The 1st Day of Learning Cobol</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/the-four-divisions/" title="The Four Divisions">The Four Divisions</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/introduction-to-programming/" title="Introduction to Programming">Introduction to Programming</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-overview/" title="COBOL Overview">COBOL Overview</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ibmmainframe.cn/2007/01/cobol-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Programming</title>
		<link>http://www.ibmmainframe.cn/2007/01/introduction-to-programming/</link>
		<comments>http://www.ibmmainframe.cn/2007/01/introduction-to-programming/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 14:34:00 +0000</pubDate>
		<dc:creator>billrain</dc:creator>
				<category><![CDATA[COBOL]]></category>

		<guid isPermaLink="false">http://www.ibmmainframe.cn/2007/01/09/introduction-to-programming/</guid>
		<description><![CDATA[Introduction to Programming Introduction In this section a gentle introduction to programing in general, and to programming in COBOL in particular, is provided. This is done by writing some simple COBOL programs that use the three main programming constructs &#8211; Sequence, Iteration and Selection. Don&#8217;t worry if you don&#8217;t understand these programs at this point.<a href="http://www.ibmmainframe.cn/2007/01/introduction-to-programming/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><table border="0" cellpadding="4" cellspacing="0" width="710">
<tbody>
<tr>
<td colspan="2" align="left" valign="top" style="color:#993300;">
<h2 align="center"><span style="color:#ffff00;"><span style="font-family:Arial, Helvetica, sans-serif;">Introduction                to Programming </span></span></h2>
</td>
</tr>
<tr>
<td align="left" height="131" valign="top" width="175" style="color:#ffffcc;">
<h4><span style="font-family:Arial, Helvetica, sans-serif;color:#800000;">Introduction</span></h4>
</td>
<td height="131" valign="top" width="525">
<p align="left">In this section a gentle introduction to programing                in general, and to programming in COBOL in particular, is provided.                This is done by writing some simple COBOL programs that use the                three main programming constructs &#8211; Sequence, Iteration and Selection.</p>
<p align="left">Don&#8217;t worry if you don&#8217;t understand these programs                at this point. The main purpose of this section is to give you a                first look at some simple COBOL programs.</p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td align="left" height="338" valign="top" width="175" style="color:#ffffcc;"><span style="font-family:Arial, Helvetica, sans-serif;color:#800000;"><b>              Let&#8217;s write a program</b></span></td>
<td height="338" valign="top" width="525">
<p align="left">A program is a collection of statements written in                a language the computer understands.            </p>
<p align="left">A computer executes program statements one after another                in sequence until it reaches the end of the program unless some                statement in the program alters the order of execution.</p>
<p align="left">Computer Scientists have shown that any program can                be written using the three main programming constructs;</p>
<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tbody>
<tr>
<td width="125"> </td>
<td><span style="font-family:Arial, Helvetica, sans-serif;font-size:2px;"><b><span style="font-size:1px;color:#000099;"><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/BallRedG.gif" height="13" hspace="10" width="13" />Sequence</span></b></span><span style="font-family:Arial, Helvetica, sans-serif;font-size:1px;color:#000099;"><b><br />                  <span style="font-size:2px;"><b><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/BallRedG.gif" height="13" hspace="10" width="13" /></b></span>Selection<br />                  <span style="font-size:2px;"><b><img src="http://www.csis.ul.ie/COBOL/Course/Resources/pics/BallRedG.gif" height="13" hspace="10" width="13" /></b></span>Iteration</b></span></td>
</tr>
</tbody>
</table>
<p align="left">This section introduces COBOL programming by writing                some simple COBOL programs using these constructs.</p>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td align="left" height="210" valign="top" width="175" style="color:#ffffcc;">
<h4><span style="font-family:Arial, Helvetica, sans-serif;color:#800000;"><b>Sequence                Program Specification</b></span></h4>
<h4> </h4>
<h4 align="center"><span style="font-size:-1px;"> </span></h4>
</td>
<td height="210" valign="top" width="525">
<p align="left">We want to write a program which will accept two numbers                from the users keyboard, multiply them together and display the                result on the computer screen.            </p>
<p align="left">Any program consists of three main things;</p>
<ol>
<li>The computer statements needed to do the job</li>
<li>Declarations for the data items that the computer statements                  need.</li>
<li>A plan, or algorithm, that arranges the computer statements                  in the program so that the computer executes them in the correct                  order.</li>
</ol>
<hr size="1" width="100%">           </td>
</tr>
<tr>
<td align="left" height="398" valign="top" width="175" style="color:#ffffcc;">
<h4><span style="font-family:Arial, Helvetica, sans-serif;color:#800000;">Program                Statements and Data items </span></h4>
</td>
<td height="398" valign="top" width="525">
<p align="left">What COBOL program statements will we need to do the                job specified above and what data items will we need to access?            </p>
<blockquote><p>We will need a statement to take in the first number and store                  it in the named memory location (a variable) &#8211; Num1<b><span style="font-family:Courier New, Courier, mono;font-size:1px;"><br />                </span><span style="font-size:1px;"><b><span style="font-family:Courier New, Courier, mono;font-size:1px;">      </span></b></span><span style="font-family:Courier New, Courier, mono;font-size:1px;">ACCEPT                  Num1.</span></b></p>
</blockquote>
<blockquote><p>We will need a statement to take in the second number and store                  it in the named memory location &#8211; Num2<b><span style="font-family:Courier New, Courier, mono;font-size:1px;"><br />                </span><span style="font-size:1px;"><b><span style="font-family:Courier New, Courier, mono;font-size:1px;">      </span></b></span><span style="font-family:Courier New, Courier, mono;font-size:1px;">ACCEPT                  Num2.</span></b></p>
</blockquote>
<blockquote><p>We will need a statement to multiply the two numbers together                  and to store the result in the named location &#8211; Result<span style="font-size:1px;"><b><br />                <span style="font-family:Courier New, Courier, mono;font-size:1px;">      </span><span style="font-family:Courier New, Courier, mono;">MULTIPLY                  Num1 BY Num2 GIVING Result.</span></b></span></p>
<p>We will need a statement to display the value in the named memory                  location “<b>Result</b>” on the computer screen -<br />                <b><span style="font-size:1px;"><b><span style="font-family:Courier New, Courier, mono;font-size:1px;">      </span></b><span style="font-family:Courier New, Courier, mono;">DISPLAY                  “Result is = “, Result.</span></span></b> </p>
</blockquote>
</td>
</tr>
</tbody>
</table>
<div class="shr-publisher-18"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/" title="The 1st Day of Learning Cobol">The 1st Day of Learning Cobol</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/the-four-divisions/" title="The Four Divisions">The Four Divisions</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-basics/" title="COBOL basics">COBOL basics</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-overview/" title="COBOL Overview">COBOL Overview</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ibmmainframe.cn/2007/01/introduction-to-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>COBOL Overview</title>
		<link>http://www.ibmmainframe.cn/2007/01/cobol-overview/</link>
		<comments>http://www.ibmmainframe.cn/2007/01/cobol-overview/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 14:26:00 +0000</pubDate>
		<dc:creator>billrain</dc:creator>
				<category><![CDATA[COBOL]]></category>

		<guid isPermaLink="false">http://www.ibmmainframe.cn/2007/01/09/cobol-overview/</guid>
		<description><![CDATA[Introduction Aims To provide a brief introduction to the programming language COBOL. To provide a context in which its uses might be understood. To introduce the Metalanguage used to describe syntactic elements of the language. To provide an introduction to the major structures present in a COBOL program. Objectives By the end of this unit<a href="http://www.ibmmainframe.cn/2007/01/cobol-overview/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><table style="height: 5381px;" border="0" cellspacing="0" cellpadding="4" width="500">
<tbody>
<tr>
<td style="color: #993300;" colspan="2" height="27" align="left" valign="top">
<h2><span style="color: #ffff00;"><span style="font-family: Arial,Helvetica,sans-serif;">Introduction</span></span></h2>
</td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="115" valign="top">
<h4><span style="color: #993300; font-family: Arial,Helvetica,sans-serif;">Aims</span></h4>
</td>
<td width="525" height="115" valign="top">
<div>
<p>To provide a brief introduction to the programming                  language COBOL. To provide a context in which its uses might be                  understood. To introduce the Metalanguage used to describe syntactic                  elements of the language. To provide an introduction to the major                  structures present in a COBOL program.</p>
</div>
<hr size="1" /></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="244" align="left" valign="top">
<h4><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;">Objectives</span></h4>
</td>
<td width="525" height="244" valign="top">By the end of this unit you should -</p>
<ol>
<li>Know what the acronym COBOL stands for.</li>
<li>Be aware of the significance of COBOL in the marketplace.</li>
<li>Understand some of the reasons for COBOL&#8217;s success.</li>
<li>Be able to understand COBOL Metalanguage syntax diagrams.</li>
<li>Be aware of the COBOL coding rules</li>
<li>Understand the structure of COBOL programs</li>
<li>Understand the purpose of the <span>IDENTIFICATION</span>,                  <span>ENVIRONMENT</span>, <span>DATA</span> and <span>PROCEDURE </span>divisions.</li>
</ol>
<hr size="1" /></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="69" align="left" valign="top">
<h4><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;">Prerequisites</span></h4>
</td>
<td width="525" height="69" valign="top">None. This is the first unit in the course.</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" bgcolor="#ffffff">
<div>
<hr /></div>
</td>
</tr>
<tr>
<td style="color: #993300;" colspan="2" align="left" valign="top">
<h2><span style="color: #ffff00;"><a name="part1"></a> <span style="font-family: Arial,Helvetica,sans-serif;">What                is COBOL?</span></span></h2>
</td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="276" align="left" valign="top">
<h4><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;"><strong>Introduction</strong></span></h4>
</td>
<td width="525" height="276" valign="top">COBOL is a high-level programming language first developed by the                CODASYL Committee (<strong>Co</strong>nference on <strong>Da</strong>ta <strong>Sy</strong>stems                <strong>L</strong>anguages) in 1960. Since then, responsibility for developing                new COBOL standards has been assumed by the American National Standards                Institute (ANSI).</p>
<p>Three ANSI standards for COBOL have been produced: in 1968, 1974                and 1985. A new COBOL standard introducing object-oriented programming                to COBOL, is due within the next few years.</p>
<p>The word <strong>COBOL</strong> is an acronym that stands for <strong>CO</strong>mmon                <strong>B</strong>usiness <strong>O</strong>riented <strong>L</strong>anguage. As the the expanded                acronym indicates, COBOL is designed for developing business, typically                file-oriented, applications. It is not designed for writing systems                programs. For instance you would not develop an operating system                or a compiler using COBOL.</p>
<hr size="1" /></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="337" align="left" valign="top">
<h4><span style="color: #800000;"><strong><span style="font-family: Arial,Helvetica,sans-serif;">How                widely used is COBOL? </span></strong></span></h4>
</td>
<td width="525" height="337" valign="top">For over four decades COBOL has been the dominant programming language                in the business computing domain. In that time it it has seen off                the challenges of a number of other languages such as PL1, Algol68,                Pascal, Modula, Ada, C, C++. All these languages have found a niche                but none has yet displaced COBOL. Two recent challengers though,                Java and Visual Basic, are proving to be serious contenders.</p>
<p>COBOL&#8217;s dominance in underlined by the reports from the Gartner                group.</p>
<blockquote><p>In 1997 they estimated that there were about 300 billion lines                  of computer code in use in the world. Of that they estimated that                  about 80% (240 billion lines) were in COBOL and 20% (60 billion                  lines) were written in all the other computer languages combined                  [<span><a href="http://www.csis.ul.ie/COBOL/Course/COBOLIntro.htm#brown">Brown</a></span>].</p>
<p>In 1999 they reported that over 50% of all new mission-critical                  applications were still being done in COBOL and their recent estimates                  indicate that through 2004-2005 15% of all new applications (5                  billion lines) will be developed in COBOL while 80% of <strong>all</strong> deployed applications will include extensions to existing legacy                  (usually COBOL) programs.</p>
<p>Gartner estimates for 2002 are that there are about two million                  COBOL programmers world-wide compared to about about one million                  Java programmers and one million C++ programmers.</p></blockquote>
<hr size="1" /></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="57" align="left" valign="top"><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;"><strong>Surprised              by COBOL&#8217;s success?</strong></span></td>
<td width="525" height="57" valign="top">People are often surprised when presented with the evidence for                COBOL&#8217;s dominance in the market place. The hype that surrounds some                computer languages would persuade you to believe that most of the                production business applications in the world are written in Java,                C, C++ or Visual Basic and that only a small percentage are written                in COBOL. In fact, the reverse is actually the case.</p>
<p>One reason for this misconception lies in the difference between                the vertical and the horizontal software markets.</p>
<p>In the vertical software market (sometimes called “bespoke”                software) applications cost many millions of dollars to produce,                are tailored to a specified company, encapsulate the business rules                of that company, and only a limited number of copies of the software                may be in use. A good example of this kind of application is the                DoD MRP II system. This system is “used to manage almost 550,000                spare and repair parts and equipment items with an inventory value                of $28 billion. The system runs on Amdahl mainframes at multiple                locations throughout the U.S. and contains over 4,000,000 lines                of COBOL code.” [<span>http://www.uppermohawkinc.com/corporate_capabilities.htm</span>]</p>
<p>In the horizontal software market, applications may still cost                millions of dollars to produce but thousands, and in some cases                millions, of copies of the software are in use. As a result, these                applications often have a very high profile, a short life span,                and a relatively low per-copy replacement cost. The Microsoft Office                suite (Word, Excel, Access) is an example of an application in the                horizontal software market. Because of the highly competitive nature                of this marketplace considerations of speed, size and efficiency                often make languages like C or C++ the language of choice for creating                these applications.</p>
<p>Applications written for the vertical market, on the other hand,                often have a low profile (because they are usually written for use                in one particular company), a very high per-copy replacement cost,                and consequently, a very long life span. For example, the cost of                replacing COBOL code has been estimated at approximately twenty                five dollars ($25) per line of code. At this rate, the cost of replacing                the DoD MRP II system mentioned above, with a system written in                some other language, would be some one hundred million dollars ($100,000,000).                The importance of ease of maintenance often makes COBOL the language                of choice for these applications.</p>
<p>The high visibility of horizontal applications like Microsoft Word                or Excel persuades people that the languages used to write these                applications are the market leaders. But however many copies of                Excel are sold, it is just a single application produced by a limited                number of programmers. Many more programmers are involved in coding                or maintaining one off, “bespoke”, applications. And these                programmers generally write their programs in COBOL.</p>
<hr size="1" /></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="423" align="left" valign="top"><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;"><strong>Some                characteristics of COBOL applications</strong></span></td>
<td width="525" height="423" valign="top">As exemplified by the DoD MRP II example above, COBOL applications                are often very large.Many COBOL applications consist of more than                1,000,000 lines of code &#8211; with 6,000,000+ line applications not                considered unusually large in many shops.</p>
<p>COBOL applications are also very long-lived.The huge investment                in creating a software application consisting of some millions of                lines of COBOL code means that the application cannot simply be                discarded when some new programming language or technology appears.                As a consequence business applications between 10 and 30 years-old                are common. This accounts for the predominance of COBOL programs                in the year 2000 problem (12,000,000 COBOL applications vs 375,000                C and C++ applications in the US alone &#8211; [<span><a href="http://www.csis.ul.ie/COBOL/Course/COBOLIntro.htm#capers">Capers                Jones</a></span>]). Twenty years ago when programmers were writing                these applications they just didn&#8217;t anticipate that they would last                into this millennium.</p>
<p>COBOL applications often run in critical areas of business. For                instance, over 95% of finance–insurance data is processed with                COBOL [<span><a href="http://www.csis.ul.ie/COBOL/Course/COBOLIntro.htm#arranga">In Cobol’s Defense</a>].</span> The serious financial and legal consequences that can result from                an application failure is one reason for the near panic over the                year 2000 problem.</p>
<p>COBOL applications often deal with enormous volumes of data.Single                production files and databases measured in terabytes are not uncommon.</p>
<hr size="1" /></td>
</tr>
<tr>
<td style="color: #ffffcc;" width="175" height="1690" align="left" valign="top"><span style="color: #800000; font-family: Arial,Helvetica,sans-serif;"><strong>Some              characteristics that contribute to COBOL&#8217;s success</strong></span></td>
<td width="525" height="1690" valign="top"><strong>COBOL is self-documenting</strong><br />
One of the design goals for COBOL was to make it possible for non-programmers                such as supervisors, managers and users, to read and understand                COBOL code. As a result, COBOL contains such English-like structural                elements as verbs, clauses, sentences, sections and divisions. As                it happens, this design goal was not realized. Managers and users                nowadays do not read COBOL programs. Computer programs are just                too complex for most laymen to understand them, however familiar                the syntactic elements. But the design goal and its effect on COBOL                syntax has had one important side-effect. It has made COBOL the                most readable, understandable and self-documenting programming language                in use today. It has also made it the most verbose.</p>
<p>It is easy for programmers unused to the business programming paradigm,                where programming with a view to ease of maintenance is very important,                to dismiss the advantage that COBOL&#8217;s readability imparts. Not only                does this readability generally assist the maintenance process but                the older a program gets the more valuable this readability becomes.</p>
<p>When programs are new, both the in-program comments and the external                documentation accurately reflect the program code. But over time,                as more and more revisions are applied to the code, it gets out                of step with the documentation until the documentation is actually                a hindrance to maintenance rather than a help. The self-documenting                nature of COBOL means that this problem is not as severe with COBOL                programs as it is with other languages</p>
<p>Readers who are familiar with C or C++ or Java might want to consider                how difficult it becomes to maintain programs written in these languages.                C programs that you have written yourself are difficult enough to                understand when you come back to them six months later. Consider                how much more difficult it would be to understand a program that                had been written fifteen years previously, by someone else, and                which had since been amended and added to by so many others that                the documentation no longer accurately reflects the program code.                This is a nightmare still awaiting maintenance programmers of the                future</p>
<p><strong>COBOL is simple<br />
</strong>COBOL is a simple language (no pointers, no user defined functions,                no user defined types) with a limited scope of function. It encourages                a simple straightforward programming style. Curiously enough though,                despite its limitations, COBOL has proven itself to be well suited                to its targeted problem domain (business computing). Most COBOL                programs operate in a domain where the program complexity lies in                the business rules that have to be encoded rather than in the sophistication                of the data structures or algorithms required. And in cases where                sophisticated algorithms are required COBOL usually meets the need                with an appropriate verb such as the <span>SORT</span> and the <span>SEARCH</span>.</p>
<p>We noted above that COBOL is a simple language with a limited                scope of function. And that is the way it used to be but the introduction                of OO-COBOL has changed all that. OO-COBOL retains all the advantages                of previous versions but now includes -</p>
<ul>
<li>
<ul>
<li>
<ul>
<li>User Defined Functions</li>
<li>Object Orientation</li>
<li>National Characters &#8211; Unicode</li>
<li>Multiple Currency Symbols</li>
<li>Cultural Adaptability (Locales)</li>
<li>Dynamic Memory Allocation (pointers)</li>
<li>Data Validation Using New VALIDATE Verb</li>
<li>Binary and Floating Point Data Types</li>
<li>User Defined Data Types</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><strong>COBOL is non-proprietary (portable)</strong><br />
The COBOL standard does not belong to any particular vendor. The                vendor independent ANSI COBOL committee legislates formal, non-vendor-specific                syntax and semantic language standards. COBOL has been ported to                virtually every hardware platform &#8211; from every favour of Windows,                to every falser of Unix, to AS/400, VSE, OS/2, DOS, VMS, Unisys,                DG, VM, and MVS.</p>
<p><strong>COBOL is Maintainable<br />
</strong>COBOL has a 30 year proven track record for application maintenance,                enhancement and production support at the enterprise level. Early                indications from the year 2000 problem are that COBOL applications                were actually cheaper to fix than applications written in more recent                languages. [<span> <a href="http://www.csis.ul.ie/COBOL/Course/COBOLIntro.htm#capers">Capers Jones</a></span>]                [<span><a href="http://www.csis.ul.ie/COBOL/Course/COBOLIntro.htm#kapple">Kappleman</a></span>]</p>
<p>One reason for the maintainability of COBOL programs has been given                above &#8211; the readability of COBOL code. Another reason is COBOL&#8217;s                rigid hierarchical structure. In COBOL programs all external references,                such as to devices, files, command sequences, collating sequences,                the currency symbol and the decimal point symbol, are defined in                the Environment Division.</p>
<p>When a COBOL program is moved to a new machine, or has new peripheral                devices attached, or is required to work in a different country;                COBOL programmers know that the parts of the program that will have                to be altered to accommodate these changes will be isolated in the                Environment Division. In other programming languages, programmer                discipline could have ensured that the references liable to change                were restricted to one part of the program but they could just as                easily be spread throughout the program. In COBOL programs, programmers                have no choice. COBOL&#8217;s rigid hierarchical structure ensures that                these items are restricted to the Environment Division.</td>
</tr>
</tbody>
</table>
<div class="shr-publisher-17"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.ibmmainframe.cn/2007/11/the-1st-day-of-learning-cobol/" title="The 1st Day of Learning Cobol">The 1st Day of Learning Cobol</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/the-four-divisions/" title="The Four Divisions">The Four Divisions</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/cobol-basics/" title="COBOL basics">COBOL basics</a></li><li><a href="http://www.ibmmainframe.cn/2007/01/introduction-to-programming/" title="Introduction to Programming">Introduction to Programming</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ibmmainframe.cn/2007/01/cobol-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.ibmmainframe.cn @ 2012-02-08 00:19:33 -->
