 




<?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: Read &amp; Write Flat file</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/read-write-flat-file/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/read-write-flat-file/</link>
	<description></description>
	<lastBuildDate>Sun, 19 May 2013 03:14:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/read-write-flat-file/#comment-97734</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 13 Oct 2011 01:13:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-97734</guid>
		<description><![CDATA[&lt;i&gt;So i am writing and reading records in same flat file.&lt;/i&gt;

Again, what file system is your &#039;flat file&#039; in?

If it is a program-described &#039;flat file&#039; in the /QSYS.LIB file system, or just a file with a single field in the record format, you can potentially get it done with some messy programming.

However, you would probably do best by doing all of the work in temporary database files. Once you have the records in database files the way you want them, you can simply convert them to .CSV format. The conversion could be as easy as a single CPYTOIMPF command.

It would be far easier doing it that way.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>So i am writing and reading records in same flat file.</i></p>
<p>Again, what file system is your &#8216;flat file&#8217; in?</p>
<p>If it is a program-described &#8216;flat file&#8217; in the /QSYS.LIB file system, or just a file with a single field in the record format, you can potentially get it done with some messy programming.</p>
<p>However, you would probably do best by doing all of the work in temporary database files. Once you have the records in database files the way you want them, you can simply convert them to .CSV format. The conversion could be as easy as a single CPYTOIMPF command.</p>
<p>It would be far easier doing it that way.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rr22</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/read-write-flat-file/#comment-97694</link>
		<dc:creator>rr22</dc:creator>
		<pubDate>Wed, 12 Oct 2011 09:27:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-97694</guid>
		<description><![CDATA[Thanks for the Reply.According to my requirement I want to read same flat  file.I am writing in this differant types of records in this like PL,PR etc...The main requirement is one PL can be attached to other PL type of records &amp; then again that PL can be attached to others PL.I have to run the loop till the the last level.So i am writing and reading records in same flat file.Please suggest.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the Reply.According to my requirement I want to read same flat  file.I am writing in this differant types of records in this like PL,PR etc&#8230;The main requirement is one PL can be attached to other PL type of records &amp; then again that PL can be attached to others PL.I have to run the loop till the the last level.So i am writing and reading records in same flat file.Please suggest.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/read-write-flat-file/#comment-97684</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Wed, 12 Oct 2011 00:44:30 +0000</pubDate>
		<guid isPermaLink="false">#comment-97684</guid>
		<description><![CDATA[BTW, the term &quot;flat file&quot; has at least three relatively common meanings. They are all distinctly different from the others. A .CSV file usually designates a particular organization of a streamfile. Streamfiles are one of the three common types of &quot;flat files&quot;

On AS/400s, that usually means that the file resides in the /root file system (or a similar file system).

If that isn&#039;t what you intend, then please give a more complete description of the file. Especially, what file system does it reside in?

Tom]]></description>
		<content:encoded><![CDATA[<p>BTW, the term &#8220;flat file&#8221; has at least three relatively common meanings. They are all distinctly different from the others. A .CSV file usually designates a particular organization of a streamfile. Streamfiles are one of the three common types of &#8220;flat files&#8221;</p>
<p>On AS/400s, that usually means that the file resides in the /root file system (or a similar file system).</p>
<p>If that isn&#8217;t what you intend, then please give a more complete description of the file. Especially, what file system does it reside in?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/read-write-flat-file/#comment-97678</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 11 Oct 2011 22:50:56 +0000</pubDate>
		<guid isPermaLink="false">#comment-97678</guid>
		<description><![CDATA[&lt;i&gt;How will i set my pointer at 2 differant levels in same flat file for read &amp; write . &lt;/i&gt;

Generally, you don&#039;t. That&#039;s not how updating usually works for streamfiles.

There are two general methods.&lt;ol&gt;
	&lt;li&gt;Open the file for reading. Open a second temporary file for writing. Read the data from the first file and copy to the second file. When you reach a point where you want to insert or delete or modify, then output the data to the second file as you want the change to be. Continue reading from one and writing to the other until you process the entire input file. Close the two files. Delete or rename the first file. Rename the second file to the original name and set its appropriate ownership and authority.&lt;/li&gt;&lt;li&gt;Or read the entire file into memory. Make the updates in memory. When finished, copy your memory back out to the file.&lt;/li&gt;
&lt;/ol&gt;
Some of that helps to explain why many database files will have more fixed-length records and fields. The database management layer handles the parts about repositioning within the file, and it is far easier when each record has the same length. This type of data processing is far better suited for database files.

You can read and reposition in the file. See for example the &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fapis%2Flseek.htm&quot;&gt;lseek()--Set File Read/Write Offset&lt;/a&gt; API, but it&#039;s almost certain you don&#039;t want to use it for what you&#039;re asking about.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>How will i set my pointer at 2 differant levels in same flat file for read &amp; write . </i></p>
<p>Generally, you don&#8217;t. That&#8217;s not how updating usually works for streamfiles.</p>
<p>There are two general methods.
<ol>
<li>Open the file for reading. Open a second temporary file for writing. Read the data from the first file and copy to the second file. When you reach a point where you want to insert or delete or modify, then output the data to the second file as you want the change to be. Continue reading from one and writing to the other until you process the entire input file. Close the two files. Delete or rename the first file. Rename the second file to the original name and set its appropriate ownership and authority.</li>
<li>Or read the entire file into memory. Make the updates in memory. When finished, copy your memory back out to the file.</li>
</ol>
<p>Some of that helps to explain why many database files will have more fixed-length records and fields. The database management layer handles the parts about repositioning within the file, and it is far easier when each record has the same length. This type of data processing is far better suited for database files.</p>
<p>You can read and reposition in the file. See for example the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fapis%2Flseek.htm">lseek()&#8211;Set File Read/Write Offset</a> API, but it&#8217;s almost certain you don&#8217;t want to use it for what you&#8217;re asking about.</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/9 queries in 0.012 seconds using memcached
Object Caching 310/313 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-19 05:21:27 -->