Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program to read employee details in an array of structures and pass it as an argument to a function and print them using cobol

Critics Rating:

Users Rating:

* PROGRAM TO READ EMPLOYEE DETAILS IN AN ARRAY OF STRUCTURES AND

* PASS IT AS AN ARGUMENT TO A FUNCTION AND PRINT THEM.

****************************************************************

   IDENTIFICATION DIVISION.

   PROGRAM-ID.

   ENVIRONMENT DIVISION.

   DATA DIVISION.

   WORKING-STORAGE SECTION.

   01 EMPLOYEE.

    02 EMP OCCURS 10 TIMES.

    03 ENO PIC 9(3).

    03 ENAME PIC X(10).

    03 BASIC PIC 9(5).

    03 TA PIC 9(4).

    03 DA PIC 9(4).

    03 GRO PIC 9(5).

   01 HEAD1.

    02 F PIC X(8).

    02 F PIC X(10) VALUE "ENO".

    02 F PIC X(15) VALUE "ENAME".

    02 F PIC X(15) VALUE "BASIC".

    02 F PIC X(10) VALUE "TA".

    02 F PIC X(10) VALUE "DA".

    02 F PIC X(10) VALUE "GROSS".

   01 UNDER.

    02 F PIC X(69) VALUE ALL "-".

   77 N PIC 9(2).

   77 I PIC 9.

   77 D PIC ZZ9.

   77 P PIC Z(4)9.99.

   PROCEDURE DIVISION.

   MAIN-PARA.

      DISPLAY "HOW MANY RECORDS YOU WANT TO ENTER?".

      ACCEPT N.

      PERFORM X-PARA VARYING I FROM 1 BY 1 UNTIL I > N.

      DISPLAY (1 , 1) ERASE.

      DISPLAY (1 , 1) HEAD1.

      DISPLAY (2 , 7) UNDER.

      MOVE 3 TO LIN.

      PERFORM Y-PARA VARYING I FROM 1 BY 1 UNTIL I > N.

      STOP RUN.

   X-PARA.

      DISPLAY (1 , 1) ERASE.

      DISPLAY "ENTER DETAILS OF EMPLOYEE : " I.

      DISPLAY "-----------------------------".

      DISPLAY "ENTER EMPLOYEE NUMBER".

      ACCEPT ENO(I).

      DISPLAY "ENTER EMPLOYEE NAME".

      ACCEPT ENAME(I).

      DISPLAY "ENTER BASIC SALARY".

      ACCEPT BASIC(I).

      DISPLAY "ENTER TA".

      ACCEPT TA(I).

      DISPLAY "ENTER DA".

      ACCEPT DA(I).

      COMPUTE GRO(I) = BASIC(I) + TA(I) + DA(I).

   Y-PARA.

      MOVE ENO(I) TO D.

      DISPLAY (LIN , 9) D.

      DISPLAY (LIN , 19) ENAME(I).

      MOVE BASIC(I) TO P.

      DISPLAY (LIN , 31) P.

      MOVE TA(I) TO P.

      DISPLAY (LIN , 43) P.

      MOVE DA(I) TO P.

      DISPLAY (LIN , 53) P.

      MOVE GRO(I) TO P.

      DISPLAY (LIN , 66) P.

      ADD 1 TO LIN.

Courtesy, Source, References & Regards: Kishore AVGK

While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright@2009-2011 by KuGuNi.com. All Rights Reserved.