<?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>The ramblings of a yorkshire tyke &#187; TypeSafety</title>
	<atom:link href="http://www.gennard.net/blog/tag/typesafety/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gennard.net/blog</link>
	<description>Life, Rants and Programming In A Blog</description>
	<lastBuildDate>Sat, 10 Jul 2010 23:04:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Type Safety and COBOL</title>
		<link>http://www.gennard.net/blog/2009/11/type-safety-and-cobol/</link>
		<comments>http://www.gennard.net/blog/2009/11/type-safety-and-cobol/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 23:27:34 +0000</pubDate>
		<dc:creator>spgennard</dc:creator>
				<category><![CDATA[CLR]]></category>
		<category><![CDATA[COBOL]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[TypeSafety]]></category>

		<guid isPermaLink="false">http://www.gennard.net/blog/?p=263</guid>
		<description><![CDATA[Having read a recent bog about COBOL and type-safety, I though I would jot down some comments. ANS85 COBOL is naturally is type-unsafe due as every data item being part of one memory region (or storage area), because of this it can make is difficult to talk to type-safe language such as Java or the [...]]]></description>
			<content:encoded><![CDATA[<p>Having read a recent bog about COBOL and type-safety, I though I would jot down some comments.</p>
<p>ANS85 COBOL is naturally is type-unsafe due as every data item being part of one memory region (or storage area), because of this it can make is difficult to talk to type-safe language such as Java or the CLR.</p>
<p>However, just like any computer language it does not stay still.  Object oriented features were added to COBOL, at this point in time you we were given the verbs to create 100% type safe application.</p>
<p>The key to writing type safe code is the use OBJECT-REFERENCE will a TYPE and using them on in your methods and using the INVOKE verb.</p>
<p>For example:</p>
<div class="codecolorer-container cobol blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="cobol codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #008000; font-weight: bold;">IDENTIFICATION</span> <span style="color: #008000; font-weight: bold;">DIVISION</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">PROGRAM-ID</span><span style="color: #000066;">.</span> &nbsp; <span style="color: #ff0000;">&quot;TypeSafeExample&quot;</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">ENVIRONMENT</span> <span style="color: #008000; font-weight: bold;">DIVISION</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">CONFIGURATION</span> <span style="color: #000080; font-weight: bold;">SECTION</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">REPOSITORY</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000; font-weight: bold;">CLASS</span> SYS-<span style="color: #008000; font-weight: bold;">STRING</span> <span style="color: #008000; font-weight: bold;">AS</span> <span style="color: #ff0000;">&quot;System.String&quot;</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">DATA</span> <span style="color: #008000; font-weight: bold;">DIVISION</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">WORKING-STORAGE</span> <span style="color: #000080; font-weight: bold;">SECTION</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;01 hello-world-<span style="color: #008000; font-weight: bold;">string</span> &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">OBJECT</span> <span style="color: #008000; font-weight: bold;">REFERENCE</span> SYS-<span style="color: #008000; font-weight: bold;">STRING</span><span style="color: #000066;">.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #008000; font-weight: bold;">PROCEDURE</span> <span style="color: #008000; font-weight: bold;">DIVISION</span><span style="color: #000066;">.</span> &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000; font-weight: bold;">SET</span> hello-world-<span style="color: #008000; font-weight: bold;">string</span> <span style="color: #000000; font-weight: bold;">TO</span> <span style="color: #ff0000;">&quot;Hello World&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">DISPLAY</span> hello-world-<span style="color: #008000; font-weight: bold;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000; font-weight: bold;">STOP</span> <span style="color: #008000; font-weight: bold;">RUN</span><span style="color: #000066;">.</span></div></div>
<p>The use of COBOL pictures can still be used, however for easy interop with other type-safe languages you really have to stick to the right types for your target environment when exposing your COBOL program to the other languages, this means if you are creating classes, the method to be consumed by other languages should use standard types, for .Net/CLR applications the use of <a href="http://msdn.microsoft.com/en-us/library/12a7a7h3(VS.71).aspx">CLS-COMPLIANT</a> types is the right approach.  For JVM applications, keep to the &#8220;core&#8221; java.lang types.  </p>
<p>Keep to these simple rules and COBOL will happy interop with type-safe languages. <img src='http://www.gennard.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-8227618096827072";
/* 468x15, created 11/23/09 */
google_ad_slot = "6592882116";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gennard.net/blog/2009/11/type-safety-and-cobol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
