Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program to Display Bank Report depending upon user choice

Posted By: Axelle Schmidt     Category: Cobol     Views: 5363

Program to Display Bank Report depending upon user choice.

Code for Program to Display Bank Report depending upon user choice in Cobol

        IDENTIFICATION DIVISION.
        PROGRAM-ID. BANK.

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

        DATA DIVISION.
        FILE SECTION.
        FD BANK-IN-FILE VALUE OF FILE-ID IS 'IDBIBANK.DAT'
                     LABEL RECORDS ARE STANDARD.
        01 BANK-REC.
                05 ACCNO        PIC 9(5).
                05 HOLDER       PIC X(25).
                05 DOO.
                        10 DD   PIC 99.
                        10 MM   PIC 99.
                        10 YY   PIC 9999.
                05 BALANCE      PIC 9(8)V99.
                05 ACCTYPE      PIC A.
                05 GENDER       PIC A.

        WORKING-STORAGE SECTION.
      *   Heading on the top of the screen.  
        01 HEADING.
                05 FILLER       PIC X(30) VALUE SPACES.
                05 TEXT         PIC X(40).

      *   Column Titles for first option.  
        01 COL-TITLE.
                05 FILLER       PIC X(1) VALUE SPACES.
                05 COL1         PIC X(5).
                05 FILLER       PIC X(3) VALUE SPACES.
                05 COL2         PIC X(5).
                05 FILLER       PIC X(10) VALUE SPACES.
                05 COL3         PIC X(5).
                05 COL4         PIC X(10).
                05 FILLER       PIC X(4) VALUE SPACES.
                05 COL5         PIC X(5).
                05 COL6         PIC X(10).
                05 FILLER       PIC X(4) VALUE SPACES.
                05 COL7         PIC X(5).
                05 COL8         PIC X(10).
      
      *   Column Titles for other options.  
        01 COL-TITLE1.
                05 FILLER       PIC X(3) VALUE SPACES.
                05 COL21        PIC X(5).
                05 FILLER       PIC X(1) VALUE SPACES.
                05 COL22        PIC X(20).
                05 FILLER       PIC X(4) VALUE SPACES.
                05 COL23        PIC X(5).
                05 FILLER       PIC X(2) VALUE SPACES.
                05 COL24        PIC X(10).
                05 FILLER       PIC X(4) VALUE SPACES.
                05 COL25        PIC X(5).
                05 FILLER       PIC X(8) VALUE SPACES.
                05 COL26        PIC X(10).

      *   Data Records for the first option.  
        01 REC-OUT.
                05 FILLER       PIC X(2) VALUE SPACES.
                05 DATA1        PIC X(5).
                05 DATA2        PIC X(12).
                05 FILLER       PIC X(3) VALUE SPACES.
                05 DATA3        PIC ZZZ.
                05 FILLER       PIC XX VALUE SPACES.
                05 DATA4        PIC Z(8).99.
                05 FILLER       PIC X(3) VALUE SPACES.
                05 DATA5        PIC ZZZ.
                05 FILLER       PIC XX VALUE SPACES.
                05 DATA6        PIC Z(8).99.
                05 FILLER       PIC X(3) VALUE SPACES.
                05 DATA7        PIC ZZZ.
                05 FILLER       PIC XX VALUE SPACES.
                05 DATA8        PIC Z(8).99.

      *   Data Records for other options.  
        01 REC-OUT1.
                05 DATA21       PIC Z(5).
                05 FILLER       PIC X(3) VALUE SPACES.
                05 DATA22       PIC X(25).
                05 FILLER       PIC X(2) VALUE SPACES.
                05 DATA23       PIC X(3).
                05 FILLER       PIC X(1) VALUE SPACES.
                05 DATA24.
                        10 DD1          PIC 99.
                        10 FILLER       PIC X VALUE '/'.
                        10 MM1          PIC 99.
                        10 FILLER       PIC X VALUE '/'.
                        10 YY1          PIC 9999.
                05 FILLER       PIC X(3) VALUE SPACES.
                05 DATA25       PIC Z(8).99 BLANK WHEN ZERO.
                05 FILLER       PIC X(2) VALUE SPACES.
                05 DATA26       PIC Z(8).99 BLANK WHEN ZERO.
        
        
      *   Totals for the account type S.  
        01 S.
                05 M-ACC        PIC 999 VALUE ZERO.
                05 M-AMT        PIC 9(8)V99 VALUE ZERO.
                05 F-ACC        PIC 999 VALUE ZERO.
                05 F-AMT        PIC 9(8)V99 VALUE ZERO.
                05 T-ACC        PIC 999 VALUE ZERO.
                05 T-AMT        PIC 9(8)V99 VALUE ZERO.

      *   Totals for the account type C.
        01 C.
                05 M-ACC        PIC 999 VALUE ZERO.
                05 M-AMT        PIC 9(8)V99 VALUE ZERO.
                05 F-ACC        PIC 999 VALUE ZERO.
                05 F-AMT        PIC 9(8)V99 VALUE ZERO.
                05 T-ACC        PIC 999 VALUE ZERO.
                05 T-AMT        PIC 9(8)V99 VALUE ZERO.
      
      *   Totals for the account type O.
        01 O.
                05 M-ACC        PIC 999 VALUE ZERO.
                05 M-AMT        PIC 9(8)V99 VALUE ZERO.
                05 F-ACC        PIC 999 VALUE ZERO.
                05 F-AMT        PIC 9(8)V99 VALUE ZERO.
                05 T-ACC        PIC 999 VALUE ZERO.
                05 T-AMT        PIC 9(8)V99 VALUE ZERO.
      
      *   Other process variables.
        77 START-AMT    PIC 9(8)V99 VALUE ZERO. 
        77 STOP-AMT     PIC 9(8)V99 VALUE ZERO.     
        77 D-LINE       PIC X(79) VALUE ALL '-'.
        77 B-LINE       PIC X(79) VALUE ALL ' '.
        77 TYPE         PIC A.
        77 CHOICE       PIC 9 VALUE ZERO.
        77 EOF          PIC A VALUE 'N'.

        PROCEDURE DIVISION.
      
      *   Main Para.  
        MAIN-PARA.
                OPEN INPUT BANK-IN-FILE.
                PERFORM ASK-USER.
                STOP RUN.

      *   Para to ask user for a choice.
        ASK-USER.
                DISPLAY (1, 1) ERASE.
                DISPLAY " ".
                DISPLAY " ".
                DISPLAY "  1.  A/C. SUMMARY".
                DISPLAY "  2.  LIST OF GIVEN TYPE OF ACCOUNT".
                DISPLAY "  3.  LIST WITHN GIVEN RANGE OF AMOUNT".
                DISPLAY "  4.  LIST A/C. OPENED DURING GIVEN YEAR".
                DISPLAY "  5.  EXIT".
                DISPLAY " ".
                DISPLAY "  ENTER YOUR CHOICE :=> ".
                ACCEPT CHOICE.
                PERFORM CHOICE-PARA.
      
      *   Check the user given choice.
        CHOICE-PARA.
                IF CHOICE = 1
                        PERFORM CHOICE-1
                ELSE IF CHOICE = 2
                        PERFORM CHOICE-2
                ELSE IF CHOICE = 3
                        PERFORM CHOICE-3
                ELSE IF CHOICE = 4
                        PERFORM CHOICE-4
                ELSE IF CHOICE = 5
                        PERFORM CLOSE-PARA.
      
      *   Para for the user choice 1.
        CHOICE-1.
                 DISPLAY (1, 1) ERASE.
                 MOVE 'IDBI BANK LTD' TO TEXT.
                 DISPLAY " " HEADING.
                 MOVE 'ACCONT SUMMARY' TO TEXT.
                 DISPLAY " " HEADING.

                 DISPLAY D-LINE.
                 MOVE 'A/C' TO COL1 COL2.
                 MOVE  ' ' TO COL3, COL5, COL7.
                 MOVE 'MALES' TO COL4.
                 MOVE 'FEMALES' TO COL6.
                 MOVE 'TOTAL' TO COL8.
                 DISPLAY COL-TITLE.

                 MOVE 'TYPE' TO COL1.
                 MOVE 'NAME' TO COL2.
                 MOVE  'NO' TO COL3, COL5, COL7.
                 MOVE 'BAL. AMT.' TO COL4 COL6 COL8.
                 DISPLAY COL-TITLE.
                 DISPLAY D-LINE.
                 READ BANK-IN-FILE.
                 PERFORM CALC-PARA UNTIL EOF = 'Y'.
      
      *   Depending upon the Account type generate totals.
        CALC-PARA.

                 IF ACCTYPE = 'S'
                         PERFORM SAV-PARA
                 ELSE IF ACCTYPE = 'C'
                        PERFORM CUR-PARA          
                 ELSE
                        PERFORM OVER-PARA.

                 READ BANK-IN-FILE AT END PERFORM REC-PARA.

        SAV-PARA.
                 IF GENDER = 'M'
                        ADD 1 TO M-ACC OF S
                        ADD BALANCE TO M-AMT OF S
                 ELSE
                        ADD 1 TO F-ACC OF S
                        ADD BALANCE TO F-AMT OF S.
        CUR-PARA.
                 IF GENDER = 'M'
                        ADD 1 TO M-ACC OF C
                        ADD BALANCE TO M-AMT OF C
                 ELSE
                        ADD 1 TO F-ACC OF C
                        ADD BALANCE TO F-AMT OF C.
        OVER-PARA.        
                 IF GENDER = 'M'
                        ADD 1 TO M-ACC OF O
                        ADD BALANCE TO M-AMT OF O
                 ELSE
                        ADD 1 TO F-ACC OF O
                        ADD BALANCE TO F-AMT OF O.
      
      *   Displaying the Records  .
        REC-PARA.
                MOVE 'S' TO DATA1.
                MOVE 'SAVING' TO DATA2.
                MOVE M-ACC OF S TO DATA3.
                MOVE M-AMT OF S TO DATA4.
                MOVE F-ACC OF S TO DATA5.
                MOVE F-AMT OF S TO DATA6.
                ADD M-ACC OF S  F-ACC OF S GIVING T-ACC OF S.
                MOVE T-ACC OF S TO DATA7.
                ADD M-AMT OF S  F-AMT OF S GIVING T-AMT OF S.
                MOVE T-AMT OF S TO DATA8.
                DISPLAY REC-OUT.

                MOVE 'C' TO DATA1.
                MOVE 'CURRENT' TO DATA2.
                MOVE M-ACC OF C TO DATA3.
                MOVE M-AMT OF C TO DATA4.
                MOVE F-ACC OF C TO DATA5.
                MOVE F-AMT OF C TO DATA6.
                ADD M-ACC OF C  F-ACC OF C GIVING T-ACC OF C.
                MOVE T-ACC OF C TO DATA7.
                ADD M-AMT OF C  F-AMT OF C GIVING T-AMT OF C.
                MOVE T-AMT OF C TO DATA8.
                DISPLAY REC-OUT.

                MOVE 'O' TO DATA1.
                MOVE 'OVER DRAFT' TO DATA2.
                MOVE M-ACC OF O TO DATA3.
                MOVE M-AMT OF O TO DATA4.
                MOVE F-ACC OF O TO DATA5.
                MOVE F-AMT OF O TO DATA6.
                ADD M-ACC OF O  F-ACC OF O GIVING T-ACC OF O.
                MOVE T-ACC OF O TO DATA7.
                ADD M-AMT OF O  F-AMT OF O GIVING T-AMT OF O.
                MOVE T-AMT OF O TO DATA8.
                DISPLAY REC-OUT.

                DISPLAY D-LINE.
                MOVE ' '  TO DATA1.
                MOVE 'TOTALS' TO DATA2.
                ADD M-ACC OF S M-ACC OF C M-ACC OF O
                   GIVING DATA3.
                ADD M-AMT OF S M-AMT OF C M-AMT OF O
                   GIVING DATA4.

                ADD F-ACC OF S F-ACC OF C F-ACC OF O
                   GIVING DATA5.
                ADD F-AMT OF S F-AMT OF C F-AMT OF O
                   GIVING DATA6.

                ADD T-ACC OF S T-ACC OF C T-ACC OF O
                   GIVING DATA7.
                ADD T-AMT OF S T-AMT OF C T-AMT OF O
                   GIVING DATA8.

                DISPLAY REC-OUT.
                DISPLAY D-LINE.
                DISPLAY B-LINE.
                DISPLAY B-LINE.
                MOVE 'Y' TO EOF.
      
      *   Para for the user choice 2.
        CHOICE-2.
                 DISPLAY (1, 1) ERASE.
                 DISPLAY "SELECT THE ACCOUNT TYPE [S/C/O] :- ".
                 ACCEPT TYPE.
                 MOVE 'IDBI BANK LTD' TO TEXT.
                 DISPLAY " " HEADING.
                 MOVE 'REPORT FOR GIVEN ACC. TYPE' TO TEXT.
                 DISPLAY " " HEADING.

                 PERFORM COL-2.
                 
                 
                 READ BANK-IN-FILE.
                 PERFORM DISP-REC2 UNTIL EOF = 'Y'.
                 
                 PERFORM FOOT-RPT.
      
      *   To print the footer report for choice other than 1.  
        FOOT-RPT.
                 DISPLAY D-LINE.
                 MOVE SPACES TO REC-OUT1.
                 MOVE 'TOTAL' TO DATA22.
                 MOVE M-AMT OF S TO DATA25.
                 MOVE F-AMT OF S TO DATA26.
                 DISPLAY REC-OUT1.
                 DISPLAY D-LINE.
                 MOVE 'GRAND TOTAL' TO DATA22.
                 
                 ADD M-AMT OF S, F-AMT OF S GIVING DATA26.
                 MOVE ZEROS TO DATA25.
                 DISPLAY REC-OUT1.
                 DISPLAY D-LINE.
                 DISPLAY B-LINE.
      
      *   Printing the columns for choice other than 1.
        COL-2.
                 DISPLAY D-LINE.
                 MOVE 'A/C' TO COL21.
                 MOVE 'HOLDER' TO COL22.
                 MOVE 'A/C' TO COL23.
                 MOVE 'OPENING' TO COL24.
                 MOVE 'MALE' TO COL25.
                 MOVE 'FEMALE' TO COL26.
                 DISPLAY COL-TITLE1.

                 MOVE 'NO' TO COL21.
                 MOVE 'NAME' TO COL22.
                 MOVE 'TYPE' TO COL23.
                 MOVE 'DATE' TO COL24.
                 MOVE 'BALANCE' TO COL25, COL26.
                 DISPLAY COL-TITLE1.
                 DISPLAY D-LINE.
                 MOVE ZEROS TO M-AMT OF S.
                 MOVE ZEROS TO F-AMT OF S.
      
      *   Records printing for choice other than 1.
        DISP-REC2.
                 IF ACCTYPE = TYPE
                        MOVE ACCNO TO DATA21
                        MOVE HOLDER TO DATA22
                        MOVE ACCTYPE TO DATA23
                        MOVE DD TO DD1 
                        MOVE MM TO MM1
                        MOVE YY TO YY1               
                        IF GENDER = 'M'
                                MOVE ZEROS TO DATA26
                                MOVE BALANCE TO DATA25
                                ADD BALANCE TO M-AMT OF S
                        ELSE                          
                                MOVE ZEROS TO DATA25
                                MOVE BALANCE TO DATA26
                                ADD BALANCE TO F-AMT OF S.

                 IF ACCTYPE = TYPE
                        DISPLAY REC-OUT1.

                 READ BANK-IN-FILE AT END MOVE 'Y' TO EOF.
      
      *   Para for user choice 3.
        CHOICE-3.
                 DISPLAY (1, 1) ERASE.
                 DISPLAY "GIVE THE STARTING RANGE :- ".
                 ACCEPT START-AMT.
                 DISPLAY "GIVE THE STOPING RANGE :- ".
                 ACCEPT STOP-AMT.

                 MOVE 'IDBI BANK LTD' TO TEXT.
                 DISPLAY " " HEADING.
                 MOVE 'REPORT FOR GIVEN RANGE' TO TEXT.
                 DISPLAY " " HEADING.

                 PERFORM COL-2.

                 READ BANK-IN-FILE.
                 PERFORM DISP-REC3 UNTIL EOF = 'Y'.
                 
                 PERFORM FOOT-RPT.
      
      *   Displaying records for choice = 3.           
        DISP-REC3.
                 IF (BALANCE > START-AMT OR
                        BALANCE = START-AMT) AND
                    (BALANCE < STOP-AMT OR
                        BALANCE = STOP-AMT)

                        MOVE ACCNO TO DATA21
                        MOVE HOLDER TO DATA22
                        MOVE ACCTYPE TO DATA23
                        MOVE DD TO DD1 
                        MOVE MM TO MM1
                        MOVE YY TO YY1               
                        IF GENDER = 'M'
                                MOVE ZEROS TO DATA26
                                MOVE BALANCE TO DATA25
                                ADD BALANCE TO M-AMT OF S
                        ELSE                          
                                MOVE ZEROS TO DATA25
                                MOVE BALANCE TO DATA26
                                ADD BALANCE TO F-AMT OF S.
                 
                 IF (BALANCE > START-AMT OR
                        BALANCE = START-AMT) AND
                    (BALANCE < STOP-AMT OR
                        BALANCE = STOP-AMT)

                        DISPLAY REC-OUT1.

                 READ BANK-IN-FILE AT END MOVE 'Y' TO EOF.

      *   Para for user choice = 4.  
        CHOICE-4.
                 DISPLAY (1, 1) ERASE.
                 DISPLAY "GIVE THE YEAR :- ".
                 ACCEPT START-AMT.

                 MOVE 'IDBI BANK LTD' TO TEXT.
                 DISPLAY " " HEADING.
                 MOVE 'A/C. OPENED IN ASKED YEAR' TO TEXT.
                 DISPLAY " " HEADING.

                 PERFORM COL-2.

                 READ BANK-IN-FILE.
                 PERFORM DISP-REC4 UNTIL EOF = 'Y'.
                 
                 PERFORM FOOT-RPT.
      
      *   Display records for user choice = 4.           
        DISP-REC4.
                 IF YY = START-AMT

                        MOVE ACCNO TO DATA21
                        MOVE HOLDER TO DATA22
                        MOVE ACCTYPE TO DATA23
                        MOVE DD TO DD1 
                        MOVE MM TO MM1
                        MOVE YY TO YY1               
                        IF GENDER = 'M'
                                MOVE ZEROS TO DATA26
                                MOVE BALANCE TO DATA25
                                ADD BALANCE TO M-AMT OF S
                        ELSE                          
                                MOVE ZEROS TO DATA25
                                MOVE BALANCE TO DATA26
                                ADD BALANCE TO F-AMT OF S.
                 
                 IF YY = START-AMT
                        DISPLAY REC-OUT1.

                 READ BANK-IN-FILE AT END MOVE 'Y' TO EOF.
        
        CLOSE-PARA.
                CLOSE BANK-IN-FILE.
                STOP RUN.
                
  
Share: 


Didn't find what you were looking for? Find more on Program to Display Bank Report depending upon user choice Or get search suggestion and latest updates.

Axelle Schmidt
Axelle Schmidt author of Program to Display Bank Report depending upon user choice 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!