home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / 3x400 / datespan.lzh / DATESPAN.DOC < prev    next >
Text File  |  1987-07-17  |  7KB  |  85 lines

  1. =======================================================================         
  2. The datespan program DATESPAN is a stand alone application that may be          
  3. called from HLL programs to perform span calculations.                          
  4.                                                                                 
  5. A command interface is provided to DATESPAN.  The CPP is named                  
  6. DATESPAN1. The command is named DATESPAN.                                       
  7.                                                                                 
  8. Use of the DATESPAN stand-alone program is explained below.                     
  9. =======================================================================         
  10. PROGRAM NAME:      DATESPAN                                                     
  11. PROGRAM TYPE:      CLP                                                          
  12.                                                                                 
  13. PURPOSE:           Determine the number of days between two dates.              
  14.                                                                                 
  15. PARAMETERS:        DATE1    (MMDDYY)                                            
  16.                    DATE2    (MMDDYY)                                            
  17.                    SPANTYPE (1,-1,0)  Default(0)                                
  18.                    DAYS     Return Variable                                     
  19.                    FLAG     Return Variable                                     
  20.                                                                                 
  21. PARAMETER                                                                       
  22. ATTRIBUTES:        DATE1    TYPE(*DEC)  LEN(6 0)                                
  23.                    DATE2    TYPE(*DEC)  LEN(6 0)                                
  24.                    SPANTYPE TYPE(*DEC)  LEN(1 0)                                
  25.                    DAYS     TYPE(*DEC)  LEN(6 0)                                
  26.                    FLAG     TYPE(*CHAR) LEN(1)                                  
  27.                                                                                 
  28. PROGRAM DESCRIPTION:                                                            
  29.                                                                                 
  30.      Datespan will return the number of days between any two 20th               
  31. century dates.                                                                  
  32.                                                                                 
  33.      The date parameters are numeric and are in month/day/year format.          
  34.                                                                                 
  35.      The spantype parameter determines the inclusion or exclusion of            
  36. the date parameters when the span is calculated.  To illustrate the use         
  37. of the spantype parameter assume the following dates: 01/01/87 and              
  38. 01/02/87.                                                                       
  39.                                                                                 
  40.      A spantype of 0 is the most commonly requested spantype.  Spantype         
  41. 0 returns the number of ELAPSED days between two dates. Using the dates         
  42. discussed above, the value returned in the DAYS variable for a spantype         
  43. of 0 will be a ONE.  Spantype 0 is the default spantype if an invalid           
  44. spantype is passed to the program.                                              
  45.                                                                                 
  46.      If the spantype parameter is 1, then both dates are used when              
  47. calculating the span of days between the dates. The value placed in the         
  48. DAYS return variable will be a TWO.                                             
  49.                                                                                 
  50.      A spantype of -1 returns the number of days between the date               
  51. parameters, but does not include either date in the span calculation.           
  52. The value returned in the DAYS variable for a spantype of -1, using the         
  53. above dates, would be ZERO.                                                     
  54.                                                                                 
  55.      The FLAG parameter is used to notify the calling program that an           
  56. error occurred during execution of DATESPAN.  DATESPAN validates the            
  57. dates passed to it. If either date is invalid DATESPAN returns a '*' in         
  58. the FLAG variable.  If no error occurs, FLAG contains a blank.                  
  59.                                                                                 
  60. =======================================================================         
  61.                                                                                 
  62. * ================== *                                                          
  63. * RPG CODING EXAMPLE *                                                          
  64. * ================== *                                                          
  65.      C*                                                                         
  66.      C           DATSPN    PLIST                           DATE SPAN PGM.       
  67.      C                     PARM           MDY1    60       DATE1                
  68.      C                     PARM           MDY2    60       DATE2                
  69.      C                     PARM +0        SPNTYP  10       SPAN TYPE            
  70.      C                     PARM           DAYSPN  60       NUMBER OF DAYS       
  71.      C                     PARM ' '       FLAG    1        RETURN CODE.         
  72.      C*                                                                         
  73.      C           DSCHDT    MULT +100.0001 MDY1             CALC DIFF BTWN       
  74.      C           DRDYDT    MULT +100.0001 MDY2             SCHEDULED DATE       
  75.      C*                                                    AND READY DATE.      
  76.      C                     CALL 'DATESPAN'DATSPN           GET DATE SPAN.       
  77.      C           FLAG      IFEQ ' '                        IF NO ERROR SET      
  78.      C                     Z-ADDDAYSPN    DRDYEL           DAYS EARLY/LATE      
  79.      C                     ELSE                            ELSE                 
  80.      C                     Z-ADD*ZERO     DRDYEL           EARLY/LATE = 0.      
  81.      C                     END                                                  
  82.      C*                                                                         
  83. =======================================================================         
  84.                                            
  85. ============================================================