School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,212 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,564 people online right now. Registration is fast and FREE... Join Now!




COBOL Headers

 

COBOL Headers

53greek53

29 Sep, 2009 - 05:08 PM
Post #1

New D.I.C Head
*

Joined: 27 Nov, 2008
Posts: 49



Thanked: 2 times
My Contributions
I am trying to get the headers in the following program to print on every page. Also I only want to print 20 lines per page. Any help would be appreciated.
CODE
       Identification Division.
       Program-Id. Payroll-Calc.
       Author. Sam Eliopulos.
       Environment Division.
       INPUT-OUTPUT SECTION.
       File-Control.
       Select Payroll-List assign to 'C0402.DAT'
           Organization is line Sequential.
       Select Payroll-Report assign to 'C0402.TXT'
           Organization is line Sequential.

       Data Division.
       File Section.
       FD  Payroll-List
           LABEL RECORDS ARE STANDARD
           Record Contains 88 Characters
           Data Record is Payroll-Master.
      *This Paragraph is the input data.
       01  Payroll-Master.
           05 Employee-No-In             pic x(5).
           05 Employee-Name-In           pic x(20).
           05 Territory-No-In            pic x(2).
           05 Office-No-In               pic x(2).
           05 Annual-Salary-In           pic x(6).
           05 Soc-Security-No-In         pic x(9).
           05                            pic x(35).
       FD  Payroll-Report
           LABEL RECORDS ARE STANDARD
           Record Contains 8 Characters
           Data Record is Print-Rec.
       01  Print-Rec                     pic x(88).



       Working-Storage Section.
       01 More-Data                      pic xxx value "yes".
      *This paragraph organizes the spacing of the data.
       01 Detail-Line.
           05                             pic x(1).
           05 Employee-No-Out             pic x(5).
           05                             pic x(4).
           05 Employee-Name-Out           pic x(20).
           05                             pic x(5).
           05 Territory-No-Out            pic x(2).
           05                             pic x(8).
           05 Office-No-Out               pic x(2).
           05                             pic x(10).
           05 Annual-Salary-Out           pic $zzzzzz.
           05                             pic x(5).
           05 Soc-Security-No-Out         pic XXXBXXBXXXX.
           05                             pic x(31).

       01 Heading-1.
           05                             pic x(30) Value Spaces.
           05                             pic x(7)  Value "PAYROLL".
           05                             pic x(1)  Value Spaces.
           05                             pic x(7)  Value "LISTING".
           05                             pic x(15) Value Spaces.
           05 WS-PAGE-CT                  pic 9999  Value 0001.
           05                             pic x(3)  Value Spaces.
           05 WS-DATE.
               10 CURRENT-DAY                 pic 99.
               10                             pic x(1)  Value "/".
               10 CURRENT-MONTH               pic 99.
               10                             pic x(1)  Value "/".
               10 CURRENT-YEAR                pic 9999.

       01 Heading-2.
           05                             pic x(4)  Value "EMP.".
           05                             pic x(1)  Value Spaces.
           05                             pic x(3)  Value "NO.".
           05                             pic x(2)  Value Spaces.
           05                             pic x(8)  Value "EMPLOYEE".
           05                             pic x(1)  Value Spaces.
           05                             pic x(4)  Value "NAME".
           05                             pic x(9)  Value Spaces.
           05                             pic x(4)  Value "TERR".
           05                             pic x(1)  Value Spaces.
           05                             pic x(3)  Value "NO.".
           05                             pic x(2)  Value Spaces.
           05                             pic x(6)  Value "OFFICE".
           05                             pic x(3)  Value "NO.".
           05                             pic x(2)  Value Spaces.
           05                             pic x(6)  Value "ANNUAL".
           05                             pic x(1)  Value Spaces.
           05                             pic x(6)  Value "SALARY".
           05                             pic x(2)  Value Spaces.
           05                             pic x(3)  Value "SOC".
           05                             pic x(1)  Value Spaces.
           05                             pic x(3)  Value "SEC".
           05                             pic x(1)  Value Spaces.
           05                             pic x(3)  Value "NO.".


      *This division reads the file.
       PROCEDURE DIVISION.
       100-Payroll.
           Perform 200-HOUSEKEEPING

           Perform Until More-Data = 'No'
               Read Payroll-List
                   At End
                       Move 'No' to More-Data
                   Not At End
                       Perform 210-Process-Module
               End-Read
           End-Perform
           Perform 220-Finalize
           Display "Program Finished"
           Stop Run.
      *Opens the Files
       200-HOUSEKEEPING.
           OPEN INPUT Payroll-List
               Output Payroll-Report
               Move Function Current-Date to WS-DATE.

       210-Process-Module.
           Add 1 to WS-PAGE-CT
           Perform 300-Write-Payroll-Detail.

       220-Finalize.
           Close Payroll-List
               Payroll-Report.

       300-Write-Payroll-Detail.
      *This Paragraph Moves all the data so it can be printed.
           Move Employee-No-In to Employee-No-Out
           Move Employee-Name-In to Employee-Name-Out
           Move Territory-No-In to Territory-No-Out
           Move Office-No-In to Office-No-Out
           Move Annual-Salary-In to Annual-Salary-Out
           Move Soc-Security-No-In to Soc-Security-No-Out
           Move Detail-Line to Print-Rec
           Write Print-Rec


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 09:47PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month