CSCI 465 Extra Credit Assignment 2 -- FIXME program

FIXME program

Here is the code to use in Extra Credit Assignment 2


       Identification Division.

       Program-ID.  FIXME.
       Author.      H.H.

       Environment Division.

       Input-Output Section.

       File-Control.
 
           Select Message-File Assign to MESSAGES.
           Select Print-File   Assign to PRINTER.

       Data Division.

       File Section. 

       FD  Message-File
           Recording Mode is F.

       01  Message-Record.
           05  M-Weekday               Pic X(9).
           05                          Pic X.
           05  M-Date                  Pic 9(8).
           05                          Pic X.
           05  M-Message               Pic X(60).
           05                          Pic X.

       FD  Print-File
           Recording Mode is F.
   
       01  Print-Record                Pic X(120).

       Working-Storage Section.

       01  Todays-Date.
           05  YY                      Pic 99.
           05  MM                      Pic 99.
           05  DD                      Pic 99.

       01  Message-EOF-Flag            Pic X.

       01  Line-Count                  Pic 99.

       01  Page-Count                  Pic 99  Value 0.

       01  Dash-Count                  Pic 9.

       01  Line-Limit                  Pic 99  Value 20.

       01  Dash-Limit                  Pic 99  Value 10.

       01  Detail-Line.
           05                          Pic X(15) Value Spaces.
           05  D-Date                  Pic Z9/99/9999.                
           05                          Pic X(5)  Value Spaces.
           05  D-Weekday               Pic X(9). 
           05                          Pic X(6)  Value Spaces.
           05  D-Message               Pic X(60).
           05                          Pic X(15) Value Spaces.

       01  Dash-Line.
           05                          Pic X(15) Value Spaces.
           05                          Pic X(90) Value All '-'.
           05                          Pic X(15) Value Spaces.

       01  Page-Head.
           05                          Pic X(15) Value Spaces.
           05  Page-Date.
               10  MM                  Pic 99.
               10                      Pic X     Value '-'.
               10  DD                  Pic 99.
               10                      Pic X(3)  Value '-20'.
               10  YY                  Pic 99.
           05                          Pic X(18) Value Spaces.   
           05                          Pic X(33)
                   Value 'Messages from 2008 First Quarter'.
           05                          Pic X(22) Value Spaces.
           05                          Pic X(5)  Value 'Page '.
           05  Page-Num                Pic Z9.
           05                          Pic X(15) Value Spaces.

       01  Columns.
           05                          Pic X(15) Value Spaces.
           05                          Pic X(10) Value '   Date   '. 
           05                          Pic X(4)  Value Spaces.
           05                          Pic X(11) Value 'Day of week'.
           05                          Pic X(5)  Value Spaces.
           05                          Pic X(7)  Value 'Message'.
           05                          Pic X(68) Value Spaces.

       Procedure Division.

       000-Main.
           Accept Todays-Date from Date.
           Move Corr Todays-Date to Page-Date.

           Open Input Message-File.

           Open Output Print-File.

           Move 'N' to Message-EOF-Flag.

           Read Message-File
               At end Move 'Y' to Message-EOF-Flag
           End-Read.

           Add 1 to Line-Limit Giving Line-Count.
      *Hint:  There is nothing wrong with this line.  Figure out
      *what it is intended to do.

           Perform until Message-EOF-Flag = 'Y'
               If Line-Count >= Line-Limit
                   Move Page-Count to Page-Num
                   Write Print-Record from Page-Head
                        after Advancing Page
                   Write Print-Record from Columns
                        after Advancing 3 lines
                   Move 0 to Line-Count
               End-If
               If Dash-Count = Dash-Limit
                   Write Print-Record from Dash-Line
               End-If

               Move M-Weekday to D-Weekday
               Move M-Date    to D-Date
               Move M-Message to D-Message

               Write Print-Record from Detail-Line
                   after Advancing 2 lines
               Add 1 to Line-Count
               Add 1 to Dash-Count

               Read Message-File
           End-Perform.

           Close Print-File.

           Close Message-File.

           Stop Run.