midrange.com code scratchpad
Name:
FIND-DURATION
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
07/09/2009 10:59:08 pm
IP:
Logged
Description:
COBOL ILE FUNCTION FIND-DURATION returns a value of 100 when expecting a value of 1. This is running on OS/400 V5R3M0.
Code:
  1.        PROCESS APOST TIMESTAMP DATETIME.                   
  2.        IDENTIFICATION DIVISION.                            
  3.        PROGRAM-ID. FINDDUR.                                
  4.        AUTHOR. PLA.                                        
  5.        DATE-WRITTEN. 07/09/2009.                           
  6.       *                                                    
  7.       * Find duration test.                                
  8.       *                                                    
  9.        ENVIRONMENT DIVISION.                               
  10.        CONFIGURATION SECTION.                              
  11.        SOURCE-COMPUTER. AS400.                             
  12.        OBJECT-COMPUTER. AS400.                             
  13.        INPUT-OUTPUT SECTION.                               
  14.        FILE-CONTROL.                                       
  15.                                                            
  16.        DATA DIVISION.                                      
  17.        FILE SECTION.                                       
  18.                                                            
  19.        WORKING-STORAGE SECTION.                            
  20.        01  X                           PIC 9(09).          
  21.        01  WS-FR-TIMESTAMP             FORMAT TIMESTAMP.   
  22.        01  WS-TO-TIMESTAMP             FORMAT TIMESTAMP.   
  23.                                                              
  24.        PROCEDURE DIVISION.                                   
  25.                                                              
  26.        OPENING-PARAGRAPH.                                    
  27.            MOVE '2008-07-08-10.00.00.000000' TO              
  28.                 WS-FR-TIMESTAMP.                             
  29.            MOVE '2009-07-08-10.00.00.000000' TO              
  30.                 WS-TO-TIMESTAMP.                             
  31.            COMPUTE X = FUNCTION FIND-DURATION                
  32.                    (WS-FR-TIMESTAMP WS-TO-TIMESTAMP YEARS).  
  33.            DISPLAY X.                                        
  34.  
© 2004-2019 by midrange.com generated in 0.007s valid xhtml & css