Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM WHICH CREATE ATTENDENCE SHEET

Posted By: Birk Fischer     Category: Cobol     Views: 3892

Write a PROGRAM WHICH CREATE ATTENDENCE SHEET.

Code for PROGRAM WHICH CREATE ATTENDENCE SHEET in Cobol

       IDENTIFICATION DIVISION.
        PROGRAM-ID. SALES.

       ENVIRONMENT DIVISION.
        INPUT-OUTPUT SECTION.
         FILE-CONTROL.
          SELECT insheet ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.

          SELECT outsheet ASSIGN TO DISK
           ORGANIZATION IS LINE SEQUENTIAL.

       DATA DIVISION.
        FD insheet                             
           LABEL RECORDS ARE STANDARD
            VALUE OF FILE-ID IS "ATTEN.DAT".
            01 IN-REC.
              05 INSR-NO PIC 9.
              05 INDATE  PIC 99/99/9999.
              05 INSTRING PIC X OCCURS 60 TIMES.

        FD outsheet                             
           LABEL RECORDS ARE STANDARD
            VALUE OF FILE-ID IS "Sheet2.DAT".

        01 OUT-REC PIC X(80).

       WORKING-STORAGE SECTION.
        01 EOF PIC X VALUE "N".
        01 TOT-REC PIC 999 VALUE 1.
        01 STU PIC 999 OCCURS 60 TIMES. 
        01 STU-A PIC 999V99 OCCURS 60 TIMES.
        01 HEAD.
         02 HEADLINE PIC X(13) VALUE "RNO TOTAL %". 
        01 DETAIL-LINE.
         05 DROLL PIC Z99.
         05 DA PIC ZZ999.
         05 DPA PIC Z999.99.
        01 I PIC 99.
        01 HEAD2 PIC X(25) VALUE "TOTAL LECTURE TAKEN ARE"

        PROCEDURE DIVISION.
         READ1.
          MOVE 0 TO TOT-REC.
            PERFORM VARYING I FROM 1 BY 1 UNTIL I>60
               MOVE 0 TO STU(I) 
            END-PERFORM.           

           OPEN INPUT INSHEET.
           READ INSHEET
             AT END MOVE "Y" TO EOF
           END-READ.
           PERFORM UNTIL EOF="Y"
             PERFORM READ2
             READ INSHEET
              AT END MOVE "Y" TO EOF
             END-READ
           END-PERFORM.
           CLOSE INSHEET.

           DIVIDE TOT-REC BY 2 GIVING TOT-REC.
           PERFORM ATTPER1.
           PERFORM WRITE1.
           STOP RUN.

          READ2.
            ADD 1 TO TOT-REC.
            PERFORM VARYING I FROM 1 BY 1 UNTIL I>60
              IF INSTRING(I)="P" THEN
               ADD 1 TO STU(I)
            END-PERFORM.           

          ATTPER1.
            PERFORM VARYING I FROM 1 BY 1 UNTIL I>60
              MULTIPLY STU(I) BY 100 GIVING STU-A(I)
              DIVIDE STU-A(I) BY TOT-REC GIVING STU-A(I)
            END-PERFORM.           
             
          WRITE1.

            OPEN OUTPUT OUTSHEET.
            WRITE OUT-REC FROM HEAD2.
            WRITE OUT-REC FROM TOT-REC.
            WRITE OUT-REC FROM HEAD.
            PERFORM VARYING I FROM 1 BY 1 UNTIL I>60
               MOVE I TO DROLL
               MOVE STU(I) TO DA
               MOVE STU-A(I) TO DPA
               IF I=20 THEN
               WRITE OUT-REC FROM HEAD
               WRITE OUT-REC FROM DETAIL-LINE AFTER ADVANCING PAGE
               ELSE
               WRITE OUT-REC FROM DETAIL-LINE
            END-PERFORM.
            CLOSE OUTSHEET.


*******************************INPUT************************************
111/01/2001PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
211/01/2001PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
311/01/2001APPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
411/01/2001PPPPPPPAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
511/01/2001PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
611/01/2001PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

******************************OUTPUT************************************
TOTAL LECTURE TAKEN ARE
006
RNO TOTAL %
 01  005 083.33
 02  006 100.00
 03  006 100.00
 04  006 100.00
 05  006 100.00
 06  006 100.00
 07  006 100.00
 08  005 083.33
 09  006 100.00
 10  006 100.00
 11  006 100.00
 12  006 100.00
 13  006 100.00
 14  006 100.00
 15  006 100.00
 16  006 100.00
 17  006 100.00
 18  006 100.00
 19  006 100.00
RNO TOTAL %
 20  006 100.00
 21  006 100.00
 22  006 100.00
 23  006 100.00
 24  006 100.00
 25  006 100.00
 26  006 100.00
 27  006 100.00
 28  006 100.00
 29  006 100.00
 30  006 100.00
 31  006 100.00
 32  006 100.00
 33  006 100.00
 34  006 100.00
 35  006 100.00
 36  006 100.00
 37  006 100.00
 38  006 100.00
 39  006 100.00
 40  006 100.00
 41  006 100.00
 42  006 100.00
 43  006 100.00
 44  006 100.00
 45  006 100.00
 46  006 100.00
 47  006 100.00
 48  006 100.00
 49  006 100.00
 50  006 100.00
 51  006 100.00
 52  006 100.00
 53  006 100.00
 54  006 100.00
 55  006 100.00
 56  006 100.00
 57  006 100.00
 58  006 100.00
 59  006 100.00
 60  006 100.00
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM WHICH CREATE ATTENDENCE SHEET Or get search suggestion and latest updates.

Birk Fischer
Birk Fischer author of PROGRAM WHICH CREATE ATTENDENCE SHEET is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!