<?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>MinhTech.com &#187; Featured Tutorial</title>
	<atom:link href="http://minhtech.com/category/featuredtutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://minhtech.com</link>
	<description>Yet another technology tutorial blog.</description>
	<lastBuildDate>Sat, 04 Sep 2010 19:04:39 +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>Load EBCDIC in Oracle SQLLDR</title>
		<link>http://minhtech.com/featuredtutorial/convertupload-ebcdic-with-oracle-sql-loader/</link>
		<comments>http://minhtech.com/featuredtutorial/convertupload-ebcdic-with-oracle-sql-loader/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 19:07:31 +0000</pubDate>
		<dc:creator>Minh</dc:creator>
				<category><![CDATA[Featured Tutorial]]></category>

		<guid isPermaLink="false">http://minhtech.com/?p=307</guid>
		<description><![CDATA[Here is a simple way to convert data from IBM Extended Binary Coded Decimal Interchange Code, EBCDIC, format and upload into Oracle.]]></description>
			<content:encoded><![CDATA[<p>Here is a simple way to convert data from IBM Extended Binary Coded Decimal Interchange Code, EBCDIC, format and upload into Oracle.</p>
<h3>Analyze EBCDIC File:</h3>
<p>Suppose we have a file in EBCDIC format with the following field name, offset, size, and type elements:</p>
<p class="code">field1 0 10 ebcdic string(10)<br />
field2 10 5 packed decimal(5)<br />
field3 15 1 ebcdic string(1)</p>
<h3>Next, Create an Oracle Table:</h3>
<p class="code">SQL> <span class="input">create table <span class="codered">ebcdic_table</span><br />
(<br />
&#160;&#160;&#160;field1 varchar2(10)<br />
&#160;&#160;&#160;field2 number(9)<br />
&#160;&#160;&#160;field3 varchar2(1)<br />
);</span></p>
<p>Note the numeric field length.  Each byte of a packed decimal contains two digits. So &#8220;field2&#8243; is 5 * 2 = 10 = 9 digits plus the symbol. Use 5 if the numeric field is not a packed decimal.</p>
<h3>Create SQL Loader Control File:</h3>
<p class="code">> <span class="input">vi sqlldr.ctl</span><br />
LOAD DATA CHARACTERSET WE8EBCDIC500<br />
INFILE &#39;<span class="codered">/home/mnguyen/filename</span>&#39; &#34;fix <span class="codered">16</span>&#34;<br />
APPEND INTO TABLE <span class="codered">MNGUYEN.EBCDIC_TABLE</span><br />
(<br />
&#160;&#160;&#160;FIELD1 position(1:10) char,<br />
&#160;&#160;&#160;FIELD2 position(11:15) decimal,<br />
&#160;&#160;&#160;FIELD3 position(16:16) char<br />
)<br/><br />
> <span class="input">sqlldr <span class="codered">mnguyen</span> control=sqlldr.ctl log=sqlldr.log</span></p>
<p>It is super easy because Oracle handles the conversion via its built-in SQL Loader tool. Use the WE8EBCDIC500 character set and specify the correct record length (i.e. &#8220;fix #&#8221;) if an ASCII newline character is not used in the EBCDIC data. Use the &#8220;decimal external&#8221; data type if the numeric field is not a packed decimal.</p>
]]></content:encoded>
			<wfw:commentRss>http://minhtech.com/featuredtutorial/convertupload-ebcdic-with-oracle-sql-loader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
