home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / source / ch23 / CHAPT23C.COB < prev    next >
Text File  |  1998-09-14  |  3KB  |  58 lines

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