 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Replacing PLIST in RPG /FREE coding</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/replacing-plist-in-rpg-free-coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/replacing-plist-in-rpg-free-coding/</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 23:07:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/replacing-plist-in-rpg-free-coding/#comment-73170</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sun, 31 Jan 2010 11:34:48 +0000</pubDate>
		<guid isPermaLink="false">#comment-73170</guid>
		<description><![CDATA[This is not intended to be an &quot;answer&quot; but merely IMO.

I haven&#039;t seen any really good tutorial guides. The way that I learned was simply to code a couple examples of my own until it started to make sense. My first ones were well more than a decade ago, soon after they became possible.

Start with any trivial program that receives a *CHAR 10 input parm from a CL program and places a *CHAR 10 result in an output parm. The CL verifies the result. Then extend it to become a bound procedure that returns a value in addition to the output parm. The CL won&#039;t be more than a dozen lines and the RPG won&#039;t have to be much more.

Create a second sample that starts as a clone of the first. Have it accept a couple numeric values and return the sum or difference as the return value. Include an input parm that directs the action to be a sum or difference.

There is no substitute for creating your own examples and having them available from then on. At any time, you can create new clones to experiment with new needs. It doesn&#039;t take more than three or four before you have your own starter set for just about any kind of module you want to create.

Anyway, everything that you call with CALLP (Call with Prototype), either program or procedure, including the program you are writing, gets a PR. Both CALL and CALLB become CALLP. The prototype is duplicated in the calling and called programs. In the calling program, the PR replaces either the *PLIST used for the CALL or the parameter list used for CALLB, in terms of defining the characteristics of the parms.

In addition, every procedure gets a PI for itself. This replaces the *ENTRY PLIST. The PI parameter list is a replacement for any D-specs that you previously created to receive arguments.

The parameters must match between a PR and its associated PI. The match is determined by data types and lengths, as well as the order.

In most senses, that&#039;s all there is to it.

Because a PR goes into both called and calling programs (or procedures), it may be best if a single PR is created as a /COPY member and copied wherever needed. In many sites, the associated PI is in the same member. /COPY directives are used to place the PR or PI where needed. This helps ensure that definitions always match. If they don&#039;t, the compiler complains -- mismatched parms become almost impossible.

There is much that can be accomplished with PR/PI and CALLP. Significant reduction of parameter errors is only the beginning.

But practice is where the sense of knowledge comes from. If you feel it&#039;s necessary, I can supply a beginning sample CL and RPG procedure as a starter for you. I just don&#039;t know of any good tutorials.

Two useful items by Jon Paris -- &lt;a href=&quot;http://www.astradyne-uk.com/manuals/gd001102.pdf&quot;&gt;RPG IV Subprocedures: The Basics&lt;/a&gt; and &lt;a href=&quot;http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/26220p1.aspx&quot;&gt;Subprocedure Basics: How and why to convert subroutines to subprocedures&lt;/a&gt;.

That&#039;s about as good as I can do to point to useful info as you requested. If you have specific questions, I can probably give better answers.

Tom]]></description>
		<content:encoded><![CDATA[<p>This is not intended to be an &#8220;answer&#8221; but merely IMO.</p>
<p>I haven&#8217;t seen any really good tutorial guides. The way that I learned was simply to code a couple examples of my own until it started to make sense. My first ones were well more than a decade ago, soon after they became possible.</p>
<p>Start with any trivial program that receives a *CHAR 10 input parm from a CL program and places a *CHAR 10 result in an output parm. The CL verifies the result. Then extend it to become a bound procedure that returns a value in addition to the output parm. The CL won&#8217;t be more than a dozen lines and the RPG won&#8217;t have to be much more.</p>
<p>Create a second sample that starts as a clone of the first. Have it accept a couple numeric values and return the sum or difference as the return value. Include an input parm that directs the action to be a sum or difference.</p>
<p>There is no substitute for creating your own examples and having them available from then on. At any time, you can create new clones to experiment with new needs. It doesn&#8217;t take more than three or four before you have your own starter set for just about any kind of module you want to create.</p>
<p>Anyway, everything that you call with CALLP (Call with Prototype), either program or procedure, including the program you are writing, gets a PR. Both CALL and CALLB become CALLP. The prototype is duplicated in the calling and called programs. In the calling program, the PR replaces either the *PLIST used for the CALL or the parameter list used for CALLB, in terms of defining the characteristics of the parms.</p>
<p>In addition, every procedure gets a PI for itself. This replaces the *ENTRY PLIST. The PI parameter list is a replacement for any D-specs that you previously created to receive arguments.</p>
<p>The parameters must match between a PR and its associated PI. The match is determined by data types and lengths, as well as the order.</p>
<p>In most senses, that&#8217;s all there is to it.</p>
<p>Because a PR goes into both called and calling programs (or procedures), it may be best if a single PR is created as a /COPY member and copied wherever needed. In many sites, the associated PI is in the same member. /COPY directives are used to place the PR or PI where needed. This helps ensure that definitions always match. If they don&#8217;t, the compiler complains &#8212; mismatched parms become almost impossible.</p>
<p>There is much that can be accomplished with PR/PI and CALLP. Significant reduction of parameter errors is only the beginning.</p>
<p>But practice is where the sense of knowledge comes from. If you feel it&#8217;s necessary, I can supply a beginning sample CL and RPG procedure as a starter for you. I just don&#8217;t know of any good tutorials.</p>
<p>Two useful items by Jon Paris &#8212; <a href="http://www.astradyne-uk.com/manuals/gd001102.pdf">RPG IV Subprocedures: The Basics</a> and <a href="http://www.ibmsystemsmag.com/ibmi/enewsletterexclusive/26220p1.aspx">Subprocedure Basics: How and why to convert subroutines to subprocedures</a>.</p>
<p>That&#8217;s about as good as I can do to point to useful info as you requested. If you have specific questions, I can probably give better answers.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/8 queries in 0.014 seconds using memcached
Object Caching 269/270 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 00:09:26 -->