 




<?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: Convert an *iso date to *longjul in CLP</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/</link>
	<description></description>
	<lastBuildDate>Thu, 23 May 2013 01:41:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: bvining</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114954</link>
		<dc:creator>bvining</dc:creator>
		<pubDate>Mon, 07 Jan 2013 19:48:29 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114954</guid>
		<description><![CDATA[Vendor response.
Using the eXtreme CL Date and Time Support (one time charge, $19.95), available with V5R4 and all following releases, you could use the Change Date command (ChgDatXCL) as shown iin the following program (using your data values):
Pgm&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dcl&#160;&#160;&#160;&#160;&#160;&#160;&#160; Var(&amp;Today)&#160;&#160; Type(*Char) Len(10) Value(&#039;2013-01-04&#039;) Dcl&#160;&#160;&#160;&#160;&#160;&#160;&#160; Var(&amp;Answer)&#160; Type(*Char) Len(10)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ChgDatXCL&#160; Var(&amp;Answer) Fmt(*ISO) +&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; DatAdj((*Sub 6 *Days)) BasVal(&amp;Today) +&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BasFmt(*ISO)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SndPgmMsg&#160; Msg(&amp;Answer) ToPgmQ(*Ext)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EndPgm&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
To give you a feel for what the command supports, the online documentation can be found at &lt;a href=&quot;http://www.powercl.com/xcl/xclcommands/chgdatxcl&quot; rel=&quot;nofollow&quot;&gt;http://www.powercl.com/xcl/xclcommands/chgdatxcl&lt;/A&gt;
I realize you&#039;ve already written a RPG program to meet your specific need, but this (and other commands in Date and Time) might be useful in the future.
Bruce
End vendor response
&#160;]]></description>
		<content:encoded><![CDATA[<p>Vendor response.<br />
Using the eXtreme CL Date and Time Support (one time charge, $19.95), available with V5R4 and all following releases, you could use the Change Date command (ChgDatXCL) as shown iin the following program (using your data values):<br />
Pgm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dcl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Var(&amp;Today)&nbsp;&nbsp; Type(*Char) Len(10) Value(&#8217;2013-01-04&#8242;) Dcl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Var(&amp;Answer)&nbsp; Type(*Char) Len(10)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
To give you a feel for what the command supports, the online documentation can be found at <a href="http://www.powercl.com/xcl/xclcommands/chgdatxcl" rel="nofollow">http://www.powercl.com/xcl/xclcommands/chgdatxcl</a><br />
I realize you&#8217;ve already written a RPG program to meet your specific need, but this (and other commands in Date and Time) might be useful in the future.<br />
Bruce<br />
End vendor response<br />
&nbsp;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bluedragon6</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114924</link>
		<dc:creator>bluedragon6</dc:creator>
		<pubDate>Mon, 07 Jan 2013 04:18:56 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114924</guid>
		<description><![CDATA[Thanks, I ended up writing a small rpg program to just add or subtract number of days to an *iso date and called that from the CL.&#160; Cheers, Jenny]]></description>
		<content:encoded><![CDATA[<p>Thanks, I ended up writing a small rpg program to just add or subtract number of days to an *iso date and called that from the CL.&nbsp; Cheers, Jenny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114923</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Mon, 07 Jan 2013 04:12:05 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114923</guid>
		<description><![CDATA[Well, I guess it came out readable, but not presented in [code] formatting. I&#039;ll leave it alone for now.
&#160;
Tom]]></description>
		<content:encoded><![CDATA[<p>Well, I guess it came out readable, but not presented in  formatting. I&#8217;ll leave it alone for now.<br />
&nbsp;<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TomLiotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114922</link>
		<dc:creator>TomLiotta</dc:creator>
		<pubDate>Mon, 07 Jan 2013 04:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/itanswers/convert-an-iso-date-to-longjul-in-clp/#comment-114922</guid>
		<description><![CDATA[If your starting date is &#039;2013-01-04&#039;, the *LONGJUL value will be 2013004. The result of (2013004 - 6) will be 2012998. You probably can guess that the 998th day of 2012 will be quite a ways beyond the end of the year.
&#160;
In general, you can&#039;t subtract numeric values from dates. You should only subtract &quot;durations&quot;. However, CL doesn&#039;t support date duration operations.
&#160;
You could write a small RPG (or COBOL, C or REXX) procedure and bind it into your program. Or you could code some ugly CL that manipulates values to simulate date duration math. Personally, since this already about CL, I would use the &lt;a href=&quot;http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fapis%2File4a1TOC.htm&quot; rel=&quot;nofollow&quot;&gt;ILE CEE* date APIs&lt;/A&gt; to turn dates into numeric values and back into dates.
&#160;
Here&#039;s a simple example that you can do some testing with:
pgm    ( +
         &amp;FromDate    +
         &amp;NbrDays     +
         &amp;ResultDate  +
       )

   dcl   &amp;FromDate      *char       10
   dcl   &amp;NbrDays       *dec    (    3 )
   dcl   &amp;ResultDate    *char       10


   dcl   &amp;RtnVal1       *int
   dcl   &amp;RtnVal2       *int
   dcl   &amp;PicStr        *char       10   value( &#039;YYYY-MM-DD&#039; )



   callprc      CEEDAYS      ( +
                               &amp;FromDate      +
                               &amp;PicStr        +
                               &amp;RtnVal1       +
                               *omit          +
                             )

   chgvar             &amp;RtnVal2        ( &amp;RtnVal1 - &amp;NbrDays )


   callprc      CEEDATE      ( +
                               &amp;RtnVal2       +
                               &amp;PicStr        +
                               &amp;ResultDate    +
                               *omit          +
                             )

Exit:

   return

endpgm

That proc receives a date in &#039;YYYY-MM-DD&#039; format and a number of days. It subtracts the number of days from the date and returns the new resulting date. You can look at the documentation for CEEDAYS to see how it turns the date into a number. After the CL subtracts &amp;NbrDays from that number, the API docs will describe how CEEDATE turns the new number back into a date.
&#160;
Any discussion that you need for details can be continued here. I hope the formatting of the source code works out and you can read it. Be aware that this doesn&#039;t do any validation of the incoming values; the error code (function code, &lt;EM&gt;fc&lt;/EM&gt;) is omitted. That can be covered if the docs are too confusing.
&#160;
Tom]]></description>
		<content:encoded><![CDATA[<p>If your starting date is &#8217;2013-01-04&#8242;, the *LONGJUL value will be 2013004. The result of (2013004 &#8211; 6) will be 2012998. You probably can guess that the 998th day of 2012 will be quite a ways beyond the end of the year.<br />
&nbsp;<br />
In general, you can&#8217;t subtract numeric values from dates. You should only subtract &#8220;durations&#8221;. However, CL doesn&#8217;t support date duration operations.<br />
&nbsp;<br />
You could write a small RPG (or COBOL, C or REXX) procedure and bind it into your program. Or you could code some ugly CL that manipulates values to simulate date duration math. Personally, since this already about CL, I would use the <a href="http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fapis%2File4a1TOC.htm" rel="nofollow">ILE CEE* date APIs</a> to turn dates into numeric values and back into dates.<br />
&nbsp;<br />
Here&#8217;s a simple example that you can do some testing with:<br />
pgm    ( +<br />
         &amp;FromDate    +<br />
         &amp;NbrDays     +<br />
         &amp;ResultDate  +<br />
       )</p>
<p>   dcl   &amp;FromDate      *char       10<br />
   dcl   &amp;NbrDays       *dec    (    3 )<br />
   dcl   &amp;ResultDate    *char       10</p>
<p>   dcl   &amp;RtnVal1       *int<br />
   dcl   &amp;RtnVal2       *int<br />
   dcl   &amp;PicStr        *char       10   value( &#8216;YYYY-MM-DD&#8217; )</p>
<p>   callprc      CEEDAYS      ( +<br />
                               &amp;FromDate      +<br />
                               &amp;PicStr        +<br />
                               &amp;RtnVal1       +<br />
                               *omit          +<br />
                             )</p>
<p>   chgvar             &amp;RtnVal2        ( &amp;RtnVal1 &#8211; &amp;NbrDays )</p>
<p>   callprc      CEEDATE      ( +<br />
                               &amp;RtnVal2       +<br />
                               &amp;PicStr        +<br />
                               &amp;ResultDate    +<br />
                               *omit          +<br />
                             )</p>
<p>Exit:</p>
<p>   return</p>
<p>endpgm</p>
<p>That proc receives a date in &#8216;YYYY-MM-DD&#8217; format and a number of days. It subtracts the number of days from the date and returns the new resulting date. You can look at the documentation for CEEDAYS to see how it turns the date into a number. After the CL subtracts &amp;NbrDays from that number, the API docs will describe how CEEDATE turns the new number back into a date.<br />
&nbsp;<br />
Any discussion that you need for details can be continued here. I hope the formatting of the source code works out and you can read it. Be aware that this doesn&#8217;t do any validation of the incoming values; the error code (function code, <em>fc</em>) is omitted. That can be covered if the docs are too confusing.<br />
&nbsp;<br />
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/8 queries in 0.013 seconds using memcached
Object Caching 311/312 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-23 04:40:49 -->