Genrate mini Pay Slip using Mainframe(COBOL,JCL,VSAM)

MAIN PROGRAM

 OZA032.PROJECT.PDS(MOP) - 01.07                 Col
************************** Top of Data *************
    IDENTIFICATION DIVISION.                       
    PROGRAM-ID. UPDAT.                             
    ENVIRONMENT DIVISION.                          
    DATA DIVISION.                                 
    WORKING-STORAGE SECTION.                       
    77 CHO PIC 9(1).                               
    PROCEDURE DIVISION.                            
        DISPLAY "MASTER TABLE".                    
        DISPLAY "1.WRITE 2.READ 3.UPDATE 4.DELETE".
        DISPLAY "ACCOUNT TABLE".                   
        DISPLAY "5.WRITE 6.READ 7.UPDATE 8.DELETE".
        DISPLAY "9.GENERATE PAYROLL".              
        ACCEPT CHO.                                
        EVALUATE CHO                               
        WHEN 1                                     
          CALL 'RITE'                              
        WHEN 2                                     
          CALL 'RED'                               
        WHEN 3                                     
          CALL 'UPDATE'                            
        WHEN 4                                     
          CALL 'DELET'                             
        WHEN 5                                     
          CALL 'RITE1'                             
        WHEN 6      
             CALL 'RED1'        
       WHEN 7               
         CALL 'UPDATE1'     
       WHEN 8               
         CALL 'DELET1'      
       WHEN 9               
         CALL 'GENER'       
       WHEN OTHER           
         DISPLAY "INVALID"  
   END-EVALUATE.        
   STOP RUN.          

MASTER TABLE
1.WRITE

-------------------------------------------------
   OZA032.PROJECT.PDS(RITE) - 01.07             
**************************** Top of Data ********
      IDENTIFICATION DIVISION.                  
      PROGRAM-ID. ADDDATA.                      
      ENVIRONMENT DIVISION.                     
      INPUT-OUTPUT SECTION.                     
      FILE-CONTROL.                             
          SELECT ADATA ASSIGN TO DD1            
          ORGANIZATION IS INDEXED               
          ACCESS IS SEQUENTIAL                  
          RECORD KEY IS EID                     
          FILE STATUS FS1.                      
      DATA DIVISION.                            
      FILE SECTION.                             
      FD ADATA.                                 
      01 REC1.                                  
          02 EID PIC X(4).                      
          02 FILLER PIC X.                      
          02 NAM PIC X(10).                     
          02 FILLER PIC X.                      
          02 AGE PIC X(2).                      
          02 FILLER PIC X.                      
          02 PHNO PIC X(10).                    
          02 FILLER PIC X.                      
          02 LOC PIC X(12).                     
          02 FILLER PIC X.                      
          02 BLDGP PIC X(5).
      02 FILLER PIC X.     
          02 DOB PIC X(10).    
          02 FILLER PIC X(21). 
       WORKING-STORAGE SECTION. 
       77 FS1 PIC 9(2).         
       77 EID2 PIC X(4).        
   PROCEDURE DIVISION.      
       PARA1.                   
           OPEN EXTEND ADATA.   
       ACCEPT REC1.         
       WRITE REC1.          
       CLOSE ADATA.         
       STOP RUN.   

2.READ:

  OZA032.PROJECT.PDS(RED) - 01.02           
*************************** Top of Data *****
     IDENTIFICATION DIVISION.               
     PROGRAM-ID. SEAR.                      
     ENVIRONMENT DIVISION.                  
     INPUT-OUTPUT SECTION.                  
     FILE-CONTROL.                          
         SELECT MASTER ASSIGN TO DD1        
         ORGANIZATION IS INDEXED            
         ACCESS MODE IS RANDOM              
         RECORD KEY IS EID                  
         FILE STATUS FS1.                   
     DATA DIVISION.                         
     FILE SECTION.                          
     FD MASTER.                             
     01 REC1.                               
         02 EID PIC X(4).                   
         02 FILLER PIC X.                   
         02 ENAME PIC X(10).                
         02 FILLER PIC X.                   
         02 EAGE PIC X(2).                  
         02 FILLER PIC X.                   
         02 EPH PIC X(10).                  
         02 FILLER PIC X.                   
         02 ELOC PIC X(12).                 
         02 FILLER PIC X.                   
         02 EBG PIC X(5).                   
         02 FILLER PIC X.        
         02 EDOB PIC X(10).      
         02 FILLER PIC X(21).    
       WORKING-STORAGE SECTION.    
    77 FS1 PIC 9(2).            
    77 EID1 PIC X(4).           
    PROCEDURE DIVISION.         
        OPEN INPUT MASTER.      
        DISPLAY FS1.            
        ACCEPT EID.             
        PERFORM UNTIL EID = EID1
        READ MASTER KEY IS EID  
        DISPLAY REC1            
        MOVE EID TO EID1        
        ACCEPT EID              
        END-PERFORM.            
        CLOSE MASTER.           
    STOP RUN.   

3.UPDATE

     OZA032.PROJECT.PDS(UPDATE) - 01.17         
 ***************************** Top of Data ******
        IDENTIFICATION DIVISION.                
        PROGRAM-ID. UPDAT.                      
        ENVIRONMENT DIVISION.                   
        INPUT-OUTPUT SECTION.                   
        FILE-CONTROL.                           
            SELECT MASTER ASSIGN TO DD1         
            ORGANIZATION IS INDEXED             
            ACCESS MODE IS RANDOM               
            RECORD KEY IS EID                   
            FILE STATUS FS1.                    
        DATA DIVISION.                          
        FILE SECTION.                           
        FD MASTER.                              
        01 REC1.                                
            02 EID PIC X(4).                    
            02 FILLER PIC X.                    
            02 ENAME PIC X(10).                 
            02 FILLER PIC X.                    
            02 EAGE PIC X(2).                   
            02 FILLER PIC X.                    
            02 EPH PIC X(10).                   
            02 FILLER PIC X.                    
            02 ELOC PIC X(11).                  
            02 FILLER PIC X.                    
            02 EBG PIC X(5).                    
            02 FILLER PIC X.                                   
            02 EDOB PIC X(10).                                 
            02 FILLER PIC X(22).                               
       WORKING-STORAGE SECTION.                               
       77 FS1 PIC 9(2).                                       
       77 CHOICE PIC 9(1).                                    
       PROCEDURE DIVISION.                                    
          OPEN I-O MASTER.                                   
          DISPLAY FS1.                                       
          ACCEPT EID.                                        
          READ MASTER KEY IS EID.                            
          IF FS1 = 00 THEN                                   
           GO TO D-PARA                                     
          ELSE                                               
           DISPLAY "RECORD NOT FOUND"                       
           GO TO C-PARA                                     
         END-IF.                                            
     D-PARA.                                                
          DISPLAY "1.NAME,2.AGE,3.PHNO,4.LOC,5.BLDGP,6.DOB".
          ACCEPT CHOICE.                                    
          EVALUATE CHOICE                                   
           WHEN 1                                           
            ACCEPT ENAME                                    
           WHEN 2                                           
            ACCEPT EAGE                                     
           WHEN 3                                           
        ACCEPT EPH                   
       WHEN 4                        
        ACCEPT ELOC                  
       WHEN 5                        
        ACCEPT EBG                   
       WHEN 6                        
        ACCEPT EDOB                  
       WHEN OTHER                    
        DISPLAY "INVALID CHOICE"     
      END-EVALUATE.                  
      REWRITE REC1.                  
      DISPLAY FS1.                   
      DISPLAY "UPDATED SUCCESSFUL".  
 C-PARA.                             
     CLOSE MASTER.                   
     STOP RUN.     
         
4.DELET

   OZA032.PROJECT.PDS(DELET) - 01.01        
**************************** Top of Data ****
      IDENTIFICATION DIVISION.              
      PROGRAM-ID. SEAR.                     
      ENVIRONMENT DIVISION.                 
      INPUT-OUTPUT SECTION.                 
      FILE-CONTROL.                         
          SELECT MASTER ASSIGN TO DD1       
          ORGANIZATION IS INDEXED           
          ACCESS MODE IS RANDOM             
          RECORD KEY IS EID                 
          FILE STATUS FS1.                  
      DATA DIVISION.                        
      FILE SECTION.                         
      FD MASTER.                            
      01 REC1.                              
          02 EID PIC X(4).                  
          02 FILLER PIC X.                  
          02 ENAME PIC X(10).               
          02 FILLER PIC X.                  
          02 EAGE PIC X(2).                 
          02 FILLER PIC X.                  
          02 EPH PIC X(10).                 
          02 FILLER PIC X.                  
          02 ELOC PIC X(12).                
          02 FILLER PIC X.                  
          02 EBG PIC X(5).                
          02 FILLER PIC X.                
          02 EDOB PIC X(10).              
          02 FILLER PIC X(21).            
     WORKING-STORAGE SECTION.            
     77 FS1 PIC 9(2).                    
     PROCEDURE DIVISION.                 
       OPEN I-O MASTER.                
       DISPLAY FS1.                    
       ACCEPT EID.                     
       READ MASTER KEY IS EID.         
       IF FS1 = 00 THEN                
         GO TO D-PARA                  
       ELSE                            
         DISPLAY "RECORD NOT FOUND"    
         GO TO C-PARA                  
       END-IF.                         
   D-PARA.                             
       DELETE MASTER.                  
       DISPLAY FS1.                    
       DISPLAY "DELETION SUCCESSFUL".  
   C-PARA.                             
       CLOSE MASTER.                   
       STOP RUN.   

 ACCOUNT INFO

5.RITE1

 OZA032.PROJECT.PDS(RITE1) - 01.02  
************************** Top of Dat
    IDENTIFICATION DIVISION.        
    PROGRAM-ID. ADDDATA.            
    ENVIRONMENT DIVISION.           
    INPUT-OUTPUT SECTION.           
    FILE-CONTROL.                   
        SELECT ADATA ASSIGN TO DD2  
        ORGANIZATION IS INDEXED     
        ACCESS IS SEQUENTIAL        
        RECORD KEY IS EID           
        FILE STATUS FS1.            
    DATA DIVISION.                  
    FILE SECTION.                   
    FD ADATA.                       
    01 REC1.                        
        02 EID PIC X(4).            
        02 FILLER PIC X.            
        02 NAM PIC X(10).           
        02 FILLER PIC X.            
        02 DEPT PIC X(2).           
        02 FILLER PIC X.            
        02 DOJ PIC X(10).           
        02 FILLER PIC X.            
        02 PSAL PIC X(4).           
        02 FILLER PIC X(39).        
    WORKING-STORAGE SECTION.        
 77 FS1 PIC 9(2).        
 PROCEDURE DIVISION.     
 PARA1.                  
     OPEN EXTEND ADATA.  
     ACCEPT REC1.        
     WRITE REC1.         
     CLOSE ADATA.        
     STOP RUN.           

6.RED1

  OZA032.PROJECT.PDS(RED1) - 01.05             
*************************** Top of Data ********
     IDENTIFICATION DIVISION.                  
     PROGRAM-ID. SEAR.                         
     ENVIRONMENT DIVISION.                     
     INPUT-OUTPUT SECTION.                     
     FILE-CONTROL.                             
         SELECT ACINFO ASSIGN TO DD2           
         ORGANIZATION IS INDEXED               
         ACCESS MODE IS RANDOM                 
         RECORD KEY IS EID                     
         FILE STATUS FS1.                      
     DATA DIVISION.                            
     FILE SECTION.                             
     FD ACINFO.                                
     01 REC1.                                  
         02 EID PIC X(4).                      
         02 FILLER PIC X.                      
         02 ENAME PIC X(10).                   
         02 FILLER PIC X.                      
         02 DEPT PIC X(2).                     
         02 FILLER PIC X.                      
         02 DOJ PIC X(10).                     
         02 FILLER PIC X.                      
         02 PSAL PIC X(4).                     
         02 FILLER PIC X(46).                  
     WORKING-STORAGE SECTION.                  
 77 FS1 PIC 9(2).             
 77 EID1 PIC X(4).            
 PROCEDURE DIVISION.          
     OPEN INPUT ACINFO.       
     DISPLAY FS1.             
     ACCEPT EID.              
     PERFORM UNTIL EID = EID1 
     READ ACINFO KEY IS EID   
     DISPLAY REC1             
     MOVE EID TO EID1         
     ACCEPT EID               
     END-PERFORM.             
     CLOSE ACINFO.            
     STOP RUN.                

7.UPDATE1

  OZA032.PROJECT.PDS(UPDATE1) - 01.01           
*************************** Top of Data *********
     IDENTIFICATION DIVISION.                   
     PROGRAM-ID. UPDAT.                         
     ENVIRONMENT DIVISION.                      
     INPUT-OUTPUT SECTION.                      
     FILE-CONTROL.                              
         SELECT MASTER ASSIGN TO DD2            
         ORGANIZATION IS INDEXED                
         ACCESS MODE IS RANDOM                  
         RECORD KEY IS EID                      
         FILE STATUS FS1.                       
     DATA DIVISION.                             
     FILE SECTION.                              
     FD MASTER.                                 
     01 REC1.                                   
         02 EID PIC X(4).                       
         02 FILLER PIC X.                       
         02 ENAME PIC X(10).                    
         02 FILLER PIC X.                       
         02 DEPT PIC X(2).                      
         02 FILLER PIC X.                       
         02 DOJ PIC X(10).                      
         02 FILLER PIC X.                       
         02 PSAL PIC X(4).                      
         02 FILLER PIC X(39).                   
     WORKING-STORAGE SECTION.                   
 77 FS1 PIC 9(2).                             
 77 CHOICE PIC 9(1).                          
 PROCEDURE DIVISION.                          
     OPEN I-O MASTER.                         
     DISPLAY FS1.                             
     ACCEPT EID.                              
     READ MASTER KEY IS EID.                  
     IF FS1 = 00 THEN                         
       GO TO D-PARA                           
     ELSE                                     
       DISPLAY "RECORD NOT FOUND"             
       GO TO C-PARA                           
     END-IF.                                  
 D-PARA.                                      
      DISPLAY "1.NAME,2.DEPT 3.DOJ,4.PSAL".   
      ACCEPT CHOICE.                          
      EVALUATE CHOICE                         
       WHEN 1                                 
        ACCEPT ENAME                          
       WHEN 2                                 
        ACCEPT DEPT                           
       WHEN 3                                 
        ACCEPT DOJ                            
       WHEN 4                                 
        ACCEPT PSAL                           
       WHEN OTHER                             
          DISPLAY "INVALID CHOICE"        
        END-EVALUATE.                     
        REWRITE REC1.                     
        DISPLAY FS1.                      
        DISPLAY "UPDATED SUCCESSFUL".     
   C-PARA.                                
       CLOSE MASTER.                      
       STOP RUN.                          

8.DELET1

    OZA032.PROJECT.PDS(DELET1) - 01.10           
***************************** Top of Data ********
       IDENTIFICATION DIVISION.                  
       PROGRAM-ID. SEAR.                         
       ENVIRONMENT DIVISION.                     
       INPUT-OUTPUT SECTION.                     
       FILE-CONTROL.                             
           SELECT MASTER ASSIGN TO DD2           
           ORGANIZATION IS INDEXED               
           ACCESS MODE IS RANDOM                 
           RECORD KEY IS EID                     
           FILE STATUS FS1.                      
       DATA DIVISION.                            
       FILE SECTION.                             
       FD MASTER.                                
       01 REC1.                                  
           02 EID PIC X(4).                      
           02 FILLER PIC X.                      
           02 ENAME PIC X(10).                   
           02 FILLER PIC X.                      
           02 DEPT PIC X(2).                     
           02 FILLER PIC X.                      
           02 DOJ PIC X(10).                     
           02 FILLER PIC X.                      
           02 PSAL PIC X(4).                     
           02 FILLER PIC X(39).                  
       WORKING-STORAGE SECTION.                  
 77 FS1 PIC 9(2).                    
 PROCEDURE DIVISION.                 
     OPEN I-O MASTER.                
     DISPLAY FS1.                    
     ACCEPT EID.                     
     READ MASTER KEY IS EID.         
     IF FS1 = 00 THEN                
       GO TO D-PARA                  
     ELSE                            
       DISPLAY "RECORD NOT FOUND"    
       GO TO C-PARA                  
     END-IF.                         
 D-PARA.                             
     DELETE MASTER.                  
     DISPLAY FS1.                    
     DISPLAY "DELETION SUCCESSFUL".  
 C-PARA.                             
     CLOSE MASTER.                   
     STOP RUN.                       

9.GENER (PAYROLL GENERATION)

    OZA032.PROJECT.PDS(GENER) - 01.12               Col
***************************** Top of Data *************
       IDENTIFICATION DIVISION.                       
       PROGRAM-ID. SEAR.                              
       ENVIRONMENT DIVISION.                          
       INPUT-OUTPUT SECTION.                          
       FILE-CONTROL.                                  
           SELECT MASTER ASSIGN TO DD2                
           ORGANIZATION IS INDEXED                    
           ACCESS MODE IS RANDOM                      
           RECORD KEY IS EID                          
           FILE STATUS FS1.                           
       DATA DIVISION.                                 
       FILE SECTION.                                  
       FD MASTER.                                     
       01 REC1.                                       
           02 EID PIC X(4).                           
           02 FILLER PIC X.                           
           02 ENAME PIC X(10).                        
           02 FILLER PIC X.                           
           02 DEPT PIC X(2).                          
           02 FILLER PIC X.                           
           02 DOJ PIC X(10).                          
           02 FILLER PIC X.                           
           02 PSAL PIC 9(4).                          
           02 FILLER PIC X(46).                       
       WORKING-STORAGE SECTION.                       
 77 FS1 PIC 9(2).                              
 77 NPD PIC 9(2).                              
 77 SAL PIC 9(10).                             
 01 FILL.                                      
     02 FILLER PIC X(80) VALUE ALL "-".        
 01 HEAD.                                      
     02 FILLER PIC X(35).                      
     02 HEAD1 PIC X(10) VALUE "3-WAY-TECH".    
     02 FILLER PIC X(35).                      
 01 SUB.                                       
     02 FILLER PIC X(33).                      
     02 HEAD2 PIC X(14) VALUE "ADYAR, CHENNAI".
     02 FILLER PIC X(33).                      
 01 DAT.                                       
     02 FILLER PIC X(60).                      
     02 HEAD3 PIC X(6) VALUE "DATE :".         
     02 SYSDAT PIC X(10).                      
     02 FILLER PIC X(4).                       
 PROCEDURE DIVISION.                           
     ACCEPT SYSDAT FROM DATE.                  
     OPEN INPUT MASTER.                        
     DISPLAY FS1.                              
     ACCEPT EID.                               
     READ MASTER KEY IS EID.                   
     DISPLAY FS1.                              
     IF FS1 = 00 THEN                          
             GO TO D-PARA                    
           ELSE                              
             DISPLAY "RECORD NOT FOUND"      
             GO TO PARA                      
           END-IF.                           
        D-PARA.                              
           DISPLAY FILL.                     
           DISPLAY HEAD.                     
           DISPLAY SUB.                      
           DISPLAY DAT.                      
           ACCEPT NPD.                       
           DISPLAY FILL.                     
           DISPLAY "EMP ID    :" EID.        
           DISPLAY "NAME      :" ENAME.      
           DISPLAY "DESIG     :" DEPT.       
           DISPLAY "NO.OF.DAYS:" NPD.        
           COMPUTE SAL = PSAL * NPD.         
           DISPLAY "TOTAL PAY :" SAL.        
           DISPLAY FILL.                     
       PARA.                                 
           CLOSE MASTER.                     
           STOP RUN.                         


COMPILE

    OZA032.PROJECT.PDS(COMPILE) - 01.56             Columns
***************************** Top of Data *****************
//OZA032CL JOB OZA,OZA,MSGLEVEL=(1,1),                    
//             CLASS=1,MSGCLASS=X,NOTIFY=&SYSUID,REGION=6M
//JOBPROC  JCLLIB ORDER=OZASUP.SUP.PROCLIB                
//COBCL    EXEC PROC=COBCL                                
//COMPILE.SYSIN  DD  DSN=OZA032.PROJECT.PDS(MOP),DISP=SHR 
//LKED.SYSLMOD DD  DSN=OZA032.PROJEC.PDS(MOP),DISP=SHR    
//SYSPRINT DD SYSOUT=*                                    
//SYSOUT DD SYSOUT=*                                      
//                                                        
    

EXECUTE WITH SAMPLE INPUT

     OZA032.PROJECT.PDS(EXECUTE) - 01.44           
 ***************************** Top of Data *********
 //OZA032SS JOB OZA,OZA, MSGLEVEL=(1,1),           
 //          CLASS=A,MSGCLASS=M,NOTIFY=&SYSUID     
 //DEMO EXEC PGM=MOP                               
 //STEPLIB DD DSN=OZA032.PROJEC.PDS,DISP=SHR       
 //DD1 DD DSN=OZA031.MASTER.KSDS,DISP=SHR          
 //DD2 DD DSN=OZA031.ACINFO.KSDS,DISP=SHR          
 //SYSPRINT DD SYSOUT=*                            
 //SYSOUT DD SYSOUT=*                              
 //SYSIN DD *                                      
 9                                                 
 1010                                              
 26                                                
 /*                                                
 //        


SAMPLE OUTPUT

********************************* TOP OF DATA *************
MASTER TABLE                                                                   
1.WRITE 2.READ 3.UPDATE 4.DELETE                                               
ACCOUNT TABLE                                                                  
5.WRITE 6.READ 7.UPDATE 8.DELETE                                               
9.GENERATE PAYROLL                                                             
00                                                                             
00                                                                             
--------------------------------------------------------------------------------
                                   3-WAY-TECH                                  
                                 ADYAR, CHENNAI                                
                                       DATE :101020       
--------------------------------------------------------------------------------
EMP ID    :1010                                                                
NAME      :SIVARAM                                                             
DESIG     :MG                                                                  
NO.OF.DAYS:26                                                                  
TOTAL PAY :0000039000                                                          
--------------------------------------------------------------------------------
************************ BOTTOM OF DATA                                                                                                                                                                 

2 comments:

Bose said...

Awesome logic, thanks so much for the share!Pay Slip Template

NITU said...

Try...
Free PSLIP staff / employee salary slip printing software.
Download Link - http://www.xltool.in

Computers TopOfBlogs Technology Blogs Mainframe interview question and answers,mainframe jobs,cobol,vsam,jcl,cics,db2,rdbms,mvs,tso,ispf,ibm,hcl,tcs,cts,wibro Blog Directory