 




<?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: dates in rpg</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/dates-in-rpg/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/dates-in-rpg/</link>
	<description></description>
	<lastBuildDate>Tue, 21 May 2013 10:51:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/dates-in-rpg/#comment-82759</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sun, 24 Oct 2010 23:18:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-82759</guid>
		<description><![CDATA[&lt;i&gt;I&#039;m starting to use RPG.. and I&#039;d like to know how to insert... using strsql.&lt;/i&gt;

RPG and STRSQL have almost no relationship. RPG is a programming language and STRSQL is a SQL command-line utility.

You can INSERT into DATE columns by using a value that is already formatted correctly, by using a value that comes from another DATE variable or by CASTing a value into a DATE value, and possibly other ways.

If some examples of what was tried were shown, we could offer corrections or alternatives.

Be aware that SQL statements from STRSQL often won&#039;t work the same when embedded in a program. Programs commonly use host variables which can introduce some subtle differences.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>I&#8217;m starting to use RPG.. and I&#8217;d like to know how to insert&#8230; using strsql.</i></p>
<p>RPG and STRSQL have almost no relationship. RPG is a programming language and STRSQL is a SQL command-line utility.</p>
<p>You can INSERT into DATE columns by using a value that is already formatted correctly, by using a value that comes from another DATE variable or by CASTing a value into a DATE value, and possibly other ways.</p>
<p>If some examples of what was tried were shown, we could offer corrections or alternatives.</p>
<p>Be aware that SQL statements from STRSQL often won&#8217;t work the same when embedded in a program. Programs commonly use host variables which can introduce some subtle differences.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: timhawkins</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/dates-in-rpg/#comment-47219</link>
		<dc:creator>timhawkins</dc:creator>
		<pubDate>Tue, 28 Jun 2005 11:38:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-47219</guid>
		<description><![CDATA[CURRENT_DATE results in a date data type, you must first convert it to a numeric (*ISO) value.  This function will do that.  Create the function and then  use it like:

insert into filename (cvtdtetoiso(CURRENT_DATE), 20050622)

-- the lines got screwed up a little, but I&#039;m sure you can figure out what would look nice.  &quot;yoursystemlibraryname&quot; is not QSYS, its a system library above all other libraries, we store SQL functions and system wide overrides there.  No source.


-- Convert from date to an ISO date                                
                                                                   
CREATE FUNCTION yoursystemlibraryname/CvtDTEtoISO                                 
(dte    date)                                                      
RETURNS decimal(8,0)                                               
LANGUAGE SQL                                                       
SET OPTION DATFMT=*ISO,                                            
           TGTRLS=V5R3M0                                           
                                                                   
BEGIN                                                              
                                                                   
DECLARE F_OUTPUT decimal(8,0);                                     
DECLARE F_TEST INTEGER ;                                           
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET F_TEST = 1 ;         
                                                                   
SET F_TEST = 0;                                                    
SET F_OUTPUT = DECIMAL((YEAR(dte)*10000 +                        MONTH(dte)*100 +                         DAY(dte)),8);        
                                              
IF   F_TEST = 0 THEN RETURN F_OUTPUT ;        
ELSE RETURN NULL;                             
END IF;                                       
                                              
END                                           

]]></description>
		<content:encoded><![CDATA[<p>CURRENT_DATE results in a date data type, you must first convert it to a numeric (*ISO) value.  This function will do that.  Create the function and then  use it like:</p>
<p>insert into filename (cvtdtetoiso(CURRENT_DATE), 20050622)</p>
<p>&#8211; the lines got screwed up a little, but I&#8217;m sure you can figure out what would look nice.  &#8220;yoursystemlibraryname&#8221; is not QSYS, its a system library above all other libraries, we store SQL functions and system wide overrides there.  No source.</p>
<p>&#8211; Convert from date to an ISO date                                </p>
<p>CREATE FUNCTION yoursystemlibraryname/CvtDTEtoISO<br />
(dte    date)<br />
RETURNS decimal(8,0)<br />
LANGUAGE SQL<br />
SET OPTION DATFMT=*ISO,<br />
           TGTRLS=V5R3M0                                           </p>
<p>BEGIN                                                              </p>
<p>DECLARE F_OUTPUT decimal(8,0);<br />
DECLARE F_TEST INTEGER ;<br />
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET F_TEST = 1 ;         </p>
<p>SET F_TEST = 0;<br />
SET F_OUTPUT = DECIMAL((YEAR(dte)*10000 +                        MONTH(dte)*100 +                         DAY(dte)),8);        </p>
<p>IF   F_TEST = 0 THEN RETURN F_OUTPUT ;<br />
ELSE RETURN NULL;<br />
END IF;                                       </p>
<p>END                                           </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cmasse</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/dates-in-rpg/#comment-47220</link>
		<dc:creator>cmasse</dc:creator>
		<pubDate>Tue, 28 Jun 2005 04:54:09 +0000</pubDate>
		<guid isPermaLink="false">#comment-47220</guid>
		<description><![CDATA[HI,

You must use the format,as define via F13, with STRSQL.


In France, the default format is *DMY, so i use &#039;DD/MM/YY&#039;, but if you use the internationnal *ISO format, use &#039;YYYY-MM-DD&#039; (wich is the default format with JDBC/Operation Navigator).


So , look your session format with F13 in STRSQL, first.



Christian.

]]></description>
		<content:encoded><![CDATA[<p>HI,</p>
<p>You must use the format,as define via F13, with STRSQL.</p>
<p>In France, the default format is *DMY, so i use &#8216;DD/MM/YY&#8217;, but if you use the internationnal *ISO format, use &#8216;YYYY-MM-DD&#8217; (wich is the default format with JDBC/Operation Navigator).</p>
<p>So , look your session format with F13 in STRSQL, first.</p>
<p>Christian.</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/10 queries in 0.042 seconds using memcached
Object Caching 295/301 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-21 11:03:51 -->