 




<?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: Ques Regarding Date in Iseries cobol.</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/ques-regarding-date-in-iseries-cobol/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/ques-regarding-date-in-iseries-cobol/</link>
	<description></description>
	<lastBuildDate>Mon, 20 May 2013 18:21:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ques-regarding-date-in-iseries-cobol/#comment-104785</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 13 Mar 2012 07:35:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-104785</guid>
		<description><![CDATA[You can, of course, do old style date calculations in OPM COBOL (COBOL/400), but it&#039;s much easier in ILE COBOL.

All you need to do is use REDEFINES to redefine your 9-digit packed variable as an appropriate DATE item. For example:&lt;pre&gt;
       01  W-Date                          pic s9(9)
                                               packed-decimal
                                               value 02152012.
       01  W-MMDDYYYY redefines W-Date     format date &#039;%m%d@Y&#039;
                                           usage packed-decimal.&lt;/pre&gt;
Now you can use the ADD-DURATION function:&lt;pre&gt;
           move   function add-duration ( W-MMDDYYYY days 1 )
                          to  W-MMDDYYYY&lt;/pre&gt;
Tom]]></description>
		<content:encoded><![CDATA[<p>You can, of course, do old style date calculations in OPM COBOL (COBOL/400), but it&#8217;s much easier in ILE COBOL.</p>
<p>All you need to do is use REDEFINES to redefine your 9-digit packed variable as an appropriate DATE item. For example:
<pre>
       01  W-Date                          pic s9(9)
                                               packed-decimal
                                               value 02152012.
       01  W-MMDDYYYY redefines W-Date     format date '%m%d@Y'
                                           usage packed-decimal.</pre>
<p>Now you can use the ADD-DURATION function:
<pre>
           move   function add-duration ( W-MMDDYYYY days 1 )
                          to  W-MMDDYYYY</pre>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mdratwa</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/ques-regarding-date-in-iseries-cobol/#comment-104758</link>
		<dc:creator>mdratwa</dc:creator>
		<pubDate>Mon, 12 Mar 2012 13:20:23 +0000</pubDate>
		<guid isPermaLink="false">#comment-104758</guid>
		<description><![CDATA[Put the date as YYYYMMDD.
WORKING-STORAGE SECTION.                                 
                                                         
01  WS-WRK-DATE           FORMAT DATE &#039;%Y%m%d&#039;.  
                                                    
01  WS-DAYS                       PIC S9(05) COMP-3  VALUE 1.     
                                                         
01  WS-DATE                       PIC X(08).             
PROCEDURE DIVISION.  
MOVE WS-DATE TO WS-WRK-DATE .
MOVE                                               
  FUNCTION ADD-DURATION (WS-WRK-DATE DAYS WS-DAYS) TO  
   WS-DATE.                                         

If you want to substract 1 day - change WS-DAYS to -1 and use:

MOVE                                                 
  FUNCTION SUBTRACT-DURATION(WS-WRK-DATE DAYS WS-DAYS) TO 
    WS-DATE]]></description>
		<content:encoded><![CDATA[<p>Put the date as YYYYMMDD.<br />
WORKING-STORAGE SECTION.                                 </p>
<p>01  WS-WRK-DATE           FORMAT DATE &#8216;%Y%m%d&#8217;.  </p>
<p>01  WS-DAYS                       PIC S9(05) COMP-3  VALUE 1.     </p>
<p>01  WS-DATE                       PIC X(08).<br />
PROCEDURE DIVISION.<br />
MOVE WS-DATE TO WS-WRK-DATE .<br />
MOVE<br />
  FUNCTION ADD-DURATION (WS-WRK-DATE DAYS WS-DAYS) TO<br />
   WS-DATE.                                         </p>
<p>If you want to substract 1 day &#8211; change WS-DAYS to -1 and use:</p>
<p>MOVE<br />
  FUNCTION SUBTRACT-DURATION(WS-WRK-DATE DAYS WS-DAYS) TO<br />
    WS-DATE</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.112 seconds using memcached
Object Caching 281/287 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-20 19:00:43 -->