 




<?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: How to use &#8220;Program-Described-File&#8221; for converting an AS/400 numeric field into Char-field</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/</link>
	<description></description>
	<lastBuildDate>Mon, 20 May 2013 05:26:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85552</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sat, 18 Dec 2010 01:33:31 +0000</pubDate>
		<guid isPermaLink="false">#comment-85552</guid>
		<description><![CDATA[&lt;i&gt;What does this PROGRAM DESCRIBED FILE means…??&lt;/i&gt;

There are two general concepts of files in programming on the AS/400 line of systems -- externally-described files and program-described files.

The database is &#039;integrated&#039; with the operating system. Compilers use the integrated database to supply file descriptions to programs by retrieving field descriptions based on file names. In RPG, you don&#039;t need to supply I-specs for input and O-specs for output because the compiler will do that for you. The compiler retrieves the &#039;external description&#039; from the *FILE object. The file is then known as an &quot;externally-described&quot; file.

But you can choose not to use an external description for your files. You can code I-specs and O-specs to define fields yourself. A lot of printed output is still created through O-specs (for some reason that I&#039;m not clear on). When you use your own field descriptions in I- or O-specs, you are describing the file in the program. The file is then known as a &quot;program-described&quot; file.

There are some fine points that can be debated over how the F-spec relates to program- or externally-described files, but the details of I- and O-specs are the ones that external descriptions really help with.

When you create a file with CRTPF, for example, you can specify a DDS source member that includes detail definitions of all of the fields in the record format of the file. But DDS isn&#039;t required. All you really need to specify is a record length with the RCDLEN() parameter. The file is created with just a single field that covers the whole record.

You can read and write those records with RPG. But if you want the records to have the same kinds of data in various parts of all records or even in different parts, you need to define the data elements somewhere. In RPG, you create those definitions with the I- and O-specs -- program-described.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>What does this PROGRAM DESCRIBED FILE means…??</i></p>
<p>There are two general concepts of files in programming on the AS/400 line of systems &#8212; externally-described files and program-described files.</p>
<p>The database is &#8216;integrated&#8217; with the operating system. Compilers use the integrated database to supply file descriptions to programs by retrieving field descriptions based on file names. In RPG, you don&#8217;t need to supply I-specs for input and O-specs for output because the compiler will do that for you. The compiler retrieves the &#8216;external description&#8217; from the *FILE object. The file is then known as an &#8220;externally-described&#8221; file.</p>
<p>But you can choose not to use an external description for your files. You can code I-specs and O-specs to define fields yourself. A lot of printed output is still created through O-specs (for some reason that I&#8217;m not clear on). When you use your own field descriptions in I- or O-specs, you are describing the file in the program. The file is then known as a &#8220;program-described&#8221; file.</p>
<p>There are some fine points that can be debated over how the F-spec relates to program- or externally-described files, but the details of I- and O-specs are the ones that external descriptions really help with.</p>
<p>When you create a file with CRTPF, for example, you can specify a DDS source member that includes detail definitions of all of the fields in the record format of the file. But DDS isn&#8217;t required. All you really need to specify is a record length with the RCDLEN() parameter. The file is created with just a single field that covers the whole record.</p>
<p>You can read and write those records with RPG. But if you want the records to have the same kinds of data in various parts of all records or even in different parts, you need to define the data elements somewhere. In RPG, you create those definitions with the I- and O-specs &#8212; program-described.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85528</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Fri, 17 Dec 2010 12:58:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-85528</guid>
		<description><![CDATA[Program described file
F-spec - fixed format / not Externally defined
I - specs - record name
i- spec for each field

Phil]]></description>
		<content:encoded><![CDATA[<p>Program described file<br />
F-spec &#8211; fixed format / not Externally defined<br />
I &#8211; specs &#8211; record name<br />
i- spec for each field</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ddaswani</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85523</link>
		<dc:creator>Ddaswani</dc:creator>
		<pubDate>Fri, 17 Dec 2010 08:03:04 +0000</pubDate>
		<guid isPermaLink="false">#comment-85523</guid>
		<description><![CDATA[@ TOM:  What does this PROGRAM DESCRIBED FILE means...??]]></description>
		<content:encoded><![CDATA[<p>@ TOM:  What does this PROGRAM DESCRIBED FILE means&#8230;??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85449</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 16 Dec 2010 02:19:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-85449</guid>
		<description><![CDATA[&lt;i&gt;U can use SQL Command or Embedded SQL,&lt;/i&gt;

But then it wouldn&#039;t be a “Program-Described-File”.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>U can use SQL Command or Embedded SQL,</i></p>
<p>But then it wouldn&#8217;t be a “Program-Described-File”.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ddaswani</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85423</link>
		<dc:creator>Ddaswani</dc:creator>
		<pubDate>Wed, 15 Dec 2010 15:28:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-85423</guid>
		<description><![CDATA[If my understanding is correct,

U can use SQL Command or Embedded SQL,

Insert  INTO LIB1/PF1 (Select all the fields)  select (all fields in sequence) from LIB2/PF2

and you can use cast to convert that field..

Correct me if i m wrong...]]></description>
		<content:encoded><![CDATA[<p>If my understanding is correct,</p>
<p>U can use SQL Command or Embedded SQL,</p>
<p>Insert  INTO LIB1/PF1 (Select all the fields)  select (all fields in sequence) from LIB2/PF2</p>
<p>and you can use cast to convert that field..</p>
<p>Correct me if i m wrong&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85302</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 14 Dec 2010 02:42:49 +0000</pubDate>
		<guid isPermaLink="false">#comment-85302</guid>
		<description><![CDATA[&lt;i&gt;I cannot question the client why they want “Program-Described-File”.&lt;/i&gt;

You should (IMO). I would.

I&#039;d point out that it will cost them more to do it that way and that they&#039;ll end up with a more difficult set of programs that will be harder to maintain in the future. IMO, pointing out issues is a matter of ethics. The client should be making informed decisions, and a consultant ought to be ethically bound to present information that helps the client to make decisions.

If the client then &lt;i&gt;chooses&lt;/i&gt; to pay extra and agrees to accept troublesome programming, then all is well.

But all of that is separate from your question. Just about everything that has been discussed above can be used with program-described or externally-described files. You just do the field work in a data structure or with substrings for a program-described file instead of with actual database fields (since there won&#039;t be any).

Anything that comes up as an obstacle can be discussed when it comes up.

Tom

p.s. Are they also requiring RPG/400?]]></description>
		<content:encoded><![CDATA[<p><i>I cannot question the client why they want “Program-Described-File”.</i></p>
<p>You should (IMO). I would.</p>
<p>I&#8217;d point out that it will cost them more to do it that way and that they&#8217;ll end up with a more difficult set of programs that will be harder to maintain in the future. IMO, pointing out issues is a matter of ethics. The client should be making informed decisions, and a consultant ought to be ethically bound to present information that helps the client to make decisions.</p>
<p>If the client then <i>chooses</i> to pay extra and agrees to accept troublesome programming, then all is well.</p>
<p>But all of that is separate from your question. Just about everything that has been discussed above can be used with program-described or externally-described files. You just do the field work in a data structure or with substrings for a program-described file instead of with actual database fields (since there won&#8217;t be any).</p>
<p>Anything that comes up as an obstacle can be discussed when it comes up.</p>
<p>Tom</p>
<p>p.s. Are they also requiring RPG/400?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: svankipu</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85258</link>
		<dc:creator>svankipu</dc:creator>
		<pubDate>Mon, 13 Dec 2010 09:04:32 +0000</pubDate>
		<guid isPermaLink="false">#comment-85258</guid>
		<description><![CDATA[Tom,

I don&#039;t know why they want a “Program-Described-File”, I dont understand their concept behind that.
I have to only follow; I cannot question the client why they want “Program-Described-File”.
I think you understand my situation.
Svanky]]></description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>I don&#8217;t know why they want a “Program-Described-File”, I dont understand their concept behind that.<br />
I have to only follow; I cannot question the client why they want “Program-Described-File”.<br />
I think you understand my situation.<br />
Svanky</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85134</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 10 Dec 2010 06:31:49 +0000</pubDate>
		<guid isPermaLink="false">#comment-85134</guid>
		<description><![CDATA[&lt;i&gt;...in the new library.
only this field&#039;s name is changed in order to avoid ambiguity. Otherwise the file-name &amp; other fields remain the same.&lt;/i&gt;

Why did you put &lt;b&gt;&quot;Program-Described-File&quot;&lt;/b&gt; in the subject of the question? If the file will be program-described, the field names won&#039;t make any difference. The program won&#039;t see the names of the fields. It won&#039;t even know that there are any fields.

Does this need to be a &quot;Program-Described-File&quot; for some reason?

Tom]]></description>
		<content:encoded><![CDATA[<p><i>&#8230;in the new library.<br />
only this field&#8217;s name is changed in order to avoid ambiguity. Otherwise the file-name &amp; other fields remain the same.</i></p>
<p>Why did you put <b>&#8220;Program-Described-File&#8221;</b> in the subject of the question? If the file will be program-described, the field names won&#8217;t make any difference. The program won&#8217;t see the names of the fields. It won&#8217;t even know that there are any fields.</p>
<p>Does this need to be a &#8220;Program-Described-File&#8221; for some reason?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-use-program-described-file-for-converting-a-numeric-field-into-char-field/#comment-85108</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 09 Dec 2010 21:28:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-85108</guid>
		<description><![CDATA[&lt;i&gt;Now the &#039;Amount&#039;Field in the file is changed to 12-char...&lt;/i&gt;

I hope someone had an extremely good reason for doing that. I can&#039;t think of any good reason for it. If it&#039;s some way to prepare data for downloading to a PC or other remote system, it shouldn&#039;t be done in a physical file -- it should be done in an IFS streamfile.

Also, I hope you&#039;re doing this with ILE RPG on a reasonably current version of i5/OS. If so, then you won&#039;t actually need an OVRDBF. It can all be done with native RPG code.

Here is some RPG that wants to work with the IBM example file QCUSTCDT in library QIWS. The file has been duplicated into a library in the library list. The program also wants to work with the duplicated file, so it has to distinguish between them. It uses two variations of the technique. One variation directly references the file and library names. The other variation builds the file name and library in a variable.

The variable file name uses USROPN to delay opening the file until the variable value is set:&lt;pre&gt;
     FQCUSTCDT1 if   e             disk    extfile( &#039;QIWS/QCUSTCDT&#039; )

     FQCUSTCDT2 if   e             disk    usropn
     f                                     extfile( CUSTCDT2  )
     f                                     extmbr( CDMBR )
     f                                     rename( CUSREC : CUSREC2 )
     f                                     prefix( QC : 2 )

     D CUSTCDT2        s             21
     D CDMBR           c                   &#039;MYMBR&#039;

                         CUSTCDT2  = %trimr( PgmLib ) + &#039;/&#039;
                                   + &#039;QCUSTCDT&#039; ;&lt;/pre&gt;
To prepare for that programming, there are a couple areas that need thought. First is the compile itself. The compiler needs to know what CUSTCDT1 and CUSTCDT2 are. And there are two ways to tell the compiler about those:&lt;ol&gt;
	&lt;li&gt;Create two file descriptions with those names by duplicating the file object. Those don&#039;t need data nor any members. Only the file descriptions need to exist in the library list for the compile. Two added file descriptions are small.&lt;/li&gt;&lt;li&gt;If you can&#039;t create extra file descriptions, then you can use two OVRDBF commands to override to the existing file in the compilation job.&lt;/li&gt;
&lt;/ol&gt;
Note that this example code uses &lt;i&gt;rename( CUSREC : CUSREC2 )&lt;/i&gt; and &lt;i&gt;prefix( QC : 2 )&lt;/i&gt; to avoid duplicating record format and field names.

The second area that is involved is when the program runs. By using the EXTFILE() keyword, the need for OVRDBF at run-time can be eliminated. No extra run-time CL is needed.

No matter how it&#039;s done, this sounds like the start of a lot of trouble as time goes by. If this is supposed to be a numeric value and it&#039;s in a database file, then it probably should not be defined as a character field.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>Now the &#8216;Amount&#8217;Field in the file is changed to 12-char&#8230;</i></p>
<p>I hope someone had an extremely good reason for doing that. I can&#8217;t think of any good reason for it. If it&#8217;s some way to prepare data for downloading to a PC or other remote system, it shouldn&#8217;t be done in a physical file &#8212; it should be done in an IFS streamfile.</p>
<p>Also, I hope you&#8217;re doing this with ILE RPG on a reasonably current version of i5/OS. If so, then you won&#8217;t actually need an OVRDBF. It can all be done with native RPG code.</p>
<p>Here is some RPG that wants to work with the IBM example file QCUSTCDT in library QIWS. The file has been duplicated into a library in the library list. The program also wants to work with the duplicated file, so it has to distinguish between them. It uses two variations of the technique. One variation directly references the file and library names. The other variation builds the file name and library in a variable.</p>
<p>The variable file name uses USROPN to delay opening the file until the variable value is set:
<pre>
     FQCUSTCDT1 if   e             disk    extfile( 'QIWS/QCUSTCDT' )

     FQCUSTCDT2 if   e             disk    usropn
     f                                     extfile( CUSTCDT2  )
     f                                     extmbr( CDMBR )
     f                                     rename( CUSREC : CUSREC2 )
     f                                     prefix( QC : 2 )

     D CUSTCDT2        s             21
     D CDMBR           c                   'MYMBR'

                         CUSTCDT2  = %trimr( PgmLib ) + '/'
                                   + 'QCUSTCDT' ;</pre>
<p>To prepare for that programming, there are a couple areas that need thought. First is the compile itself. The compiler needs to know what CUSTCDT1 and CUSTCDT2 are. And there are two ways to tell the compiler about those:
<ol>
<li>Create two file descriptions with those names by duplicating the file object. Those don&#8217;t need data nor any members. Only the file descriptions need to exist in the library list for the compile. Two added file descriptions are small.</li>
<li>If you can&#8217;t create extra file descriptions, then you can use two OVRDBF commands to override to the existing file in the compilation job.</li>
</ol>
<p>Note that this example code uses <i>rename( CUSREC : CUSREC2 )</i> and <i>prefix( QC : 2 )</i> to avoid duplicating record format and field names.</p>
<p>The second area that is involved is when the program runs. By using the EXTFILE() keyword, the need for OVRDBF at run-time can be eliminated. No extra run-time CL is needed.</p>
<p>No matter how it&#8217;s done, this sounds like the start of a lot of trouble as time goes by. If this is supposed to be a numeric value and it&#8217;s in a database file, then it probably should not be defined as a character field.</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 5/8 queries in 0.020 seconds using memcached
Object Caching 381/382 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-20 05:33:51 -->