 




<?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: Need help in moving Character field to numeric field in RPG.</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/move-operations/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 05:16:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/#comment-84956</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 07 Dec 2010 08:16:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-84956</guid>
		<description><![CDATA[I understand that the values are in a character field in a file. But why are they put into a file as character values in the first place? Where does the file come from? Why doesn&#039;t it just have a numeric field? How are you getting the file? (Why would the field be 20 characters wide? That&#039;s a big field for numeric values.)

A description of the general process would be helpful. For some kinds of files, it might be possible to do it without programming. For example, you might create a VIEW over the file so that the character column is converted to a numeric value with the DECIMAL() SQL function.

Tom]]></description>
		<content:encoded><![CDATA[<p>I understand that the values are in a character field in a file. But why are they put into a file as character values in the first place? Where does the file come from? Why doesn&#8217;t it just have a numeric field? How are you getting the file? (Why would the field be 20 characters wide? That&#8217;s a big field for numeric values.)</p>
<p>A description of the general process would be helpful. For some kinds of files, it might be possible to do it without programming. For example, you might create a VIEW over the file so that the character column is converted to a numeric value with the DECIMAL() SQL function.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kvrs80</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/#comment-84905</link>
		<dc:creator>kvrs80</dc:creator>
		<pubDate>Mon, 06 Dec 2010 19:22:24 +0000</pubDate>
		<guid isPermaLink="false">#comment-84905</guid>
		<description><![CDATA[Hi Phil/Tom,

Thanks for the solution. I will try this and let you guys know. 

Tom This value is 20 char length file field. There are some records with left aligned and i need to move to 20 numeric with leading zeros to another file as per the design.

Thanks 
Kvr.]]></description>
		<content:encoded><![CDATA[<p>Hi Phil/Tom,</p>
<p>Thanks for the solution. I will try this and let you guys know. </p>
<p>Tom This value is 20 char length file field. There are some records with left aligned and i need to move to 20 numeric with leading zeros to another file as per the design.</p>
<p>Thanks<br />
Kvr.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/#comment-84878</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Mon, 06 Dec 2010 07:42:57 +0000</pubDate>
		<guid isPermaLink="false">#comment-84878</guid>
		<description><![CDATA[Where are these values coming from? Why are you having character fields that need to be converted into numeric values?

Depending on the process, there might be better things to do.

Phil has the right answer for what you asked. I&#039;m curious if there could have been other questions at a higher level that might change the circumstances.

Tom]]></description>
		<content:encoded><![CDATA[<p>Where are these values coming from? Why are you having character fields that need to be converted into numeric values?</p>
<p>Depending on the process, there might be better things to do.</p>
<p>Phil has the right answer for what you asked. I&#8217;m curious if there could have been other questions at a higher level that might change the circumstances.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/#comment-84866</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Mon, 06 Dec 2010 03:00:06 +0000</pubDate>
		<guid isPermaLink="false">#comment-84866</guid>
		<description><![CDATA[Ohhh .. trip in the wayback machine
&quot;When a character field is moved into a numeric result field, the digit portion of each character is converted to its corresponding numeric character and then moved to the result field. Blanks are transferred as zeros&quot;
It sounds like you will need to rebuild the value as 0000001234
1.  Move Var1 WRKVAR        10
2.  Loop while position 10 of WARKVARAis a blank  -- this might require a substr to get value in position 10.
2.1  add a leading zero    &#039;0&#039; CAT WRKVAR WRkVAR  finlly WRKVAR = 0000001234
3. then MOVE WARVAR Var2  
Phil]]></description>
		<content:encoded><![CDATA[<p>Ohhh .. trip in the wayback machine<br />
&#8220;When a character field is moved into a numeric result field, the digit portion of each character is converted to its corresponding numeric character and then moved to the result field. Blanks are transferred as zeros&#8221;<br />
It sounds like you will need to rebuild the value as 0000001234<br />
1.  Move Var1 WRKVAR        10<br />
2.  Loop while position 10 of WARKVARAis a blank  &#8212; this might require a substr to get value in position 10.<br />
2.1  add a leading zero    &#8217;0&#8242; CAT WRKVAR WRkVAR  finlly WRKVAR = 0000001234<br />
3. then MOVE WARVAR Var2<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kvrs80</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/#comment-84860</link>
		<dc:creator>kvrs80</dc:creator>
		<pubDate>Sun, 05 Dec 2010 20:20:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-84860</guid>
		<description><![CDATA[Hi Philp,

Its RPG. I&#039;m having the data as 
VAr1 - &#039;1234    &#039; -  Char field
VAr2 - 000000000 - Numeric field

When i moved 
C       MOVE VAR1   VAR2 ==&gt; VAR2 - 1234000000

Thx,
KVr]]></description>
		<content:encoded><![CDATA[<p>Hi Philp,</p>
<p>Its RPG. I&#8217;m having the data as<br />
VAr1 &#8211; &#8217;1234    &#8216; &#8211;  Char field<br />
VAr2 &#8211; 000000000 &#8211; Numeric field</p>
<p>When i moved<br />
C       MOVE VAR1   VAR2 ==&gt; VAR2 &#8211; 1234000000</p>
<p>Thx,<br />
KVr</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/move-operations/#comment-84858</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sun, 05 Dec 2010 17:49:03 +0000</pubDate>
		<guid isPermaLink="false">#comment-84858</guid>
		<description><![CDATA[In RPGLE fixed format that would be
EVAL my20n = %dec(myChar:20:5)
Phil]]></description>
		<content:encoded><![CDATA[<p>In RPGLE fixed format that would be<br />
EVAL my20n = %dec(myChar:20:5)<br />
Phil</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 3/8 queries in 0.030 seconds using memcached
Object Caching 339/340 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 07:42:10 -->