home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / source / ch21 / chapt21c.cob < prev    next >
Text File  |  1998-09-24  |  3KB  |  59 lines

  1. 000010 @OPTIONS MAIN,TEST
  2. 000020 Identification Division.
  3. 000030 Program-Id.  Chapt21c.
  4. 000031* Days Between Dates
  5. 000040 Environment Division.
  6. 000050 Configuration Section.
  7. 000051 Source-Computer.  IBM-PC.
  8. 000055 Object-Computer.  IBM-PC.
  9. 000056 Data Division.
  10. 000057 Working-Storage Section.
  11. 000058 01  First-Date                Value Zeros.
  12. 000059     03  Date-MM               Pic 99.
  13. 000060     03  Date-DD               Pic 99.
  14. 000061     03  Date-YYYY             Pic 9(4).
  15. 000062 01  Second-Date               Value Zeros.
  16. 000063     03  Date-MM               Pic 99.
  17. 000064     03  Date-DD               Pic 99.
  18. 000065     03  Date-YYYY             Pic 9(4).
  19. 000066 01  Days-Between              Pic S9(12) Value Zeros.
  20. 000076 01  Integer-First-Date        Pic  9(12).
  21. 000077 01  Integer-Second-Date       Pic  9(12).
  22. 000078 01  Date-Formatting-Items.
  23. 000079     03  YYYYMMDD-Format-Date.
  24. 000080         05  Date-YYYY         Pic 9(4).
  25. 000081         05  Date-MM           Pic 99.
  26. 000082         05  Date-DD           Pic 99.
  27. 000083     03  YYYYMMDD-Format-Date-N Redefines
  28. 000084         YYYYMMDD-Format-Date  Pic 9(8).
  29. 000085     03  Format-Indicator-F    Pic X(8) Value "MMDDYYYY".
  30. 000086     03  Format-Indicator-S    Pic X(8) Value "MMDDYYYY".
  31. 000087 Screen Section.
  32. 000088 01  Date-Entry Blank Screen Auto.
  33. 000089     03  Line 01 Column 01 Value "Enter First Date: ".
  34. 000090     03  Line 01 Column 21 Pic X(8) From Format-Indicator-F
  35. 000091                                    To   First-Date.
  36. 000092     03  Line 03 Column 01 Value "Enter Second Date: ".
  37. 000093     03  Line 03 Column 21 Pic X(8) From Format-Indicator-S
  38. 000094                                    To   Second-Date.
  39. 000095     03  Line 05 Column 01 Value "Days between dates: ".
  40. 000096     03  Line 05 Column 21 Pic -Zzz,ZZ9 From Days-Between.
  41. 000097 Procedure Division.
  42. 000159 Chapt21c-Start.
  43. 000169     Display Date-Entry
  44. 000179     Accept Date-Entry
  45. 000180     Move Corresponding First-Date To YYYYMMDD-Format-Date
  46. 000181     Compute Integer-First-Date =
  47. 000182             Function Integer-Of-Date (YYYYMMDD-Format-Date-N)
  48. 000183     Move First-Date To Format-Indicator-F
  49. 000184     Move Corresponding Second-Date To YYYYMMDD-Format-Date
  50. 000185     Compute Integer-Second-Date =
  51. 000186             Function Integer-Of-Date (YYYYMMDD-Format-Date-N)
  52. 000187     Move Second-Date To Format-Indicator-S
  53. 000188     Compute Days-Between = Integer-Second-Date -
  54. 000189                            Integer-First-Date
  55. 000190     Display Date-Entry
  56. 000191     Stop Run
  57. 000192     .
  58. 000193
  59.