Project - ATM in Batch Process

Code :

000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. K1.
000040 ENVIRONMENT DIVISION.
000050 INPUT-OUTPUT SECTION.
000060 FILE-CONTROL.
000070     SELECT  OPTIONAL LOGIN-TABLE1
000080     ASSIGN TO "LL22"
000090     ORGANIZATION IS INDEXED
000100     RECORD KEY IS LPASSWD
000110     ACCESS MODE IS DYNAMIC.
000130     SELECT  OPTIONAL MAIN-TABLE1
000140     ASSIGN TO "MM22"
000150     ORGANIZATION IS INDEXED
000160     RECORD KEY IS PASSWD
000170     ACCESS MODE IS DYNAMIC.
000172     SELECT  OPTIONAL MAIN3
000173     ASSIGN TO "MAM22"
000174     ORGANIZATION IS SEQUENTIAL.
000179     SELECT PRINTFILE
000182     ASSIGN TO PRINTER.
000184     SELECT PRINT2FILE
000185     ASSIGN TO PRINTER.
000240 DATA DIVISION.
000250 FILE SECTION.
000260 FD  LOGIN-TABLE1
000270     LABEL RECORDS ARE STANDARD.
000280 01  LOGIN-RECORDS.
000290     05 LPASSWD PIC 9(4).
000300     05 LNAME PIC X(10).
000310     05 LAGE PIC XX.
000340 FD  MAIN-TABLE1
000350     LABEL RECORDS ARE STANDARD.
000360 01  MAIN-RECORDS.
000370     05 PASSWD PIC 9(4).
000380     05 TOTAL PIC S9(10)V99.
000382 FD  PRINTFILE
000383     REPORT IS MY-ATM.
000386 FD  MAIN3
000387     LABEL RECORDS ARE STANDARD.
000388 01  M2-RECORDS.
000389     05 M2-PASSWD PIC 9(4).
000390     05 M2-DT PIC X(6).
000391     05 M2-TIM PIC X(8).
000392     05 M2-SAV PIC S9(10)V99.
000393     05 M2-WITH PIC S9(10)V99.
000395     05 M2-TOTAL PIC S9(10)V99.
000397 FD PRINT2FILE
000398     REPORT IS MY-ATM2.
000402 WORKING-STORAGE SECTION.
000403 01  SP-D PIC X(100) VALUE
"**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&&&&~~~~~~~~~~~~~~~~~~~**".
000404 01  AMT-S PIC S9999999V99.
000405 01  MIN-BAL PIC 9999 VALUE 1000.
000406 01  BAL-OK PIC 9 VALUE ZERO.
000407 01  L-CHOICE PIC 9 VALUE ZERO.
000408 01  SP3 PIC XXX VALUE "   ".
000409 01  SP6 PIC X(6) VALUE "      ".
000410 01  NA PIC XXXX VALUE "AJAY".
000411 01  AG PIC X .
000412 01  L PIC XXXX VALUE "2222".
000413 01  PASS1 PIC 99999.
000414 01  OK1 PIC X VALUE "Y".
000415 01  OK2 PIC 9 VALUE ZERO.
000416 01  I PIC 9 VALUE 1.
000417 01  END-OF-FILE PIC X VALUE "N".
000418 01  TEM-PASS PIC 9999.
000419 01  TEM-NAME PIC X(10).
000420 01  TEM-AGE PIC XX.
000421 01  SURE PIC X.
000422 01  REG-NAME PIC X(10).
000423 01  REG-AGE PIC XX.
000424 01  REG-PASS PIC 9999.
000425 01  CHOICE PIC 9.
000426 01  TEM-TOTAL PIC S9(10)V99.
000427 01  REG-SAV PIC S9(10)V99.
000428 01  AMT-W PIC S9999999V99.
000429 01  NEW-TOTAL PIC S9(10)V99.
000430 01  TOTAL-B PIC S9(10)V99.
000431 01  TOTAL-BAL PIC Z(8)99.99.
000432 01  NO-OF-PERSON PIC 99.
000433 01  FLAG PIC 9.
000434 01  DT PIC X(6).
000435 01  TIM PIC X(8).
000437 01  LES PIC 99.
000438 01  STT PIC X(14).
000439 01  PGNO PIC 99.
000440 01  DDD PIC X.
000441 01  T1-DATE PIC X(6).
000442 01  T1-TIME PIC X(8).
000444 01  STATE1 PIC X(9).
000445 01  DATE11.
000446     02 YY11 PIC XX.
000447     02 MM11 PIC XX.
000448     02 DD11 PIC XX.
000449 01  TIME11.
000450     02 HH11 PIC XX.
000451     02 MO11 PIC XX.
000452     02 FILLER PIC X(8).
000454 01  DATE22.
000455     02 DD22 PIC XX.
000456     02 FILLER PIC X VALUE "/".
000457     02 MM22 PIC XX.
000458     02 FILLER PIC X VALUE "/".
000460     02 YY22 PIC XX.
000462 01  TIME22.
000463     02 HH22 PIC XX.
000464     02 FILLER PIC X VALUE ":".
000466     02 MO22 PIC XX.
000471 01  SHOW-BAL.
000472     05 FILLER PIC X(4) VALUE "  ".
000473     05 AACC PIC X(74) VALUE " YOUR CURRENT ACCOUNT BALANCE ( in
                indian Rupees ) IS ".
000474     05 D-TOTAL PIC Z(8)99.99.
000475 01  THE.
000476     05 YY PIC XX.
000477     05 MM PIC XX.
000478     05 DD PIC XX.
000479 01  THE-D.
000480*     05 FILLER PIC X(10) VALUE " DAY :".
000481     05 DDP PIC XX.
000482     05 FILLER PIC X(1) VALUE "/".
000483     05 MMP PIC XX.
000484     05 FILLER PIC X(1) VALUE "/".
000485     05 YYP PIC XX.
000487 01  DIS-REPORT.
000488     05 FILLER PIC X(3) VALUE "***".
000489*     05 FILLER PIC X(50) VALUE "                     ACCOUNT -
             REPORT".
000490     05 FILLER PIC X(8) VALUE "       ".
000491     05 FILLER PIC X(8) VALUE "NAME : ".
000492     05 DIS-NAME PIC X(10).
000493     05 FILLER PIC X(10) VALUE "  AGE : ".
000494     05 DIS-AGE PIC XX.
000495     05 FILLER PIC X(19) VALUE "   ACC BALANCE : ".
000496     05 DIS-TOT PIC Z(8)99.99.
000498 01  TABB.
000499     02  TAB OCCURS 20 TIMES INDEXED BY SI.
000500         05 TPASSWD PIC 9(4).
000501         05 TNAME PIC X(10).
000502         05 TAGE PIC XX.
000503
000504 01  RR1-MAIN.
000505     02  RR-MAIN OCCURS 20 TIMES INDEXED BY SII.
000506         05 RRPASSWD PIC 9(4).
000507         05 RRTOTAL PIC S9(10)V99.
000508
000509
000510 REPORT SECTION.
000511 RD  MY-ATM
000512     CONTROL ARE FINAL, LNAME
000513     PAGE LIMIT IS 66
000514     HEADING 2
000515     FIRST DETAIL 12
000516     LAST DETAIL 50
000517     FOOTING 58.
000518 01  TYPE IS PAGE HEADING.
000519     02 LINE 2.
000520        03 COLUMN 6 PIC X(76) VALUE ALL "#".
000521     02 LINE 4.
000522        03 COLUMN 36 PIC X(16) VALUE "ACCOUNT REPORT".
000523     02 LINE 6.
000524        03 COLUMN 6 PIC X(76) VALUE ALL "#".
000525     02 LINE 9.
000526        03 COLUMN 10 PIC X(10) VALUE "NAME ".
000527        03 COLUMN 22 PIC X(4) VALUE "AGE".
000528        03 COLUMN 30 PIC X(18) VALUE " ACCOUNT BALANCE".
000529        03 COLUMN 50 PIC X(14) VALUE "BALANCE STATUS".
000530
000531     02 LINE 10.
000532        03 COLUMN 10 PIC X(10) VALUE "---- ".
000533        03 COLUMN 22 PIC X(4) VALUE "---".
000534        03 COLUMN 30 PIC X(18) VALUE "----------------".
000535        03 COLUMN 50 PIC X(14) VALUE "--------------".
000536
000537 01  DETAIL1 TYPE IS DETAIL .
000538     02 LINE IS PLUS 1.
000539        03 COLUMN 6 PIC Z9 SOURCE PGNO.
000540
000541        03 COLUMN 10 PIC X(10) SOURCE LNAME.
000542        03 COLUMN 22 PIC X(2) SOURCE LAGE.
000543        03 COLUMN 30 PIC X(4) VALUE "Rs. ".
000544        03 COLUMN 34 PIC Z(8)99.99 SOURCE TOTAL.
000545        03 COLUMN 55 PIC X(4) SOURCE STT.
000546 01  TYPE IS CONTROL FOOTING LNAME NEXT GROUP PLUS 1.
000547     02 LINE PLUS 1.
000548        03 COLUMN 6 PIC X VALUE " ".
000549 01  TYPE IS CONTROL FOOTING FINAL.
000550     02 LINE IS 53.
000551        03 COLUMN 6 PIC X(50) VALUE "TOTAL NO OF PERSONS HAVING
ACCOUNT BALANCE LESS".
000552     02 LINE IS 54.
000553        03 COLUMN 6 PIC X(40) VALUE "MINIMUM ACCOUNT ( < Rs
1000.00 ) ARE :".
000554        03 COLUMN 64 PIC Z9 SOURCE LES.
000555     02 LINE IS 55.
000556
000557        03 COLUMN 6 PIC X(26) VALUE "TOTAL NO . OF NAMES ARE ".
000558        03 COLUMN 64 PIC Z9 SOURCE PGNO.
000559     02 LINE IS 57.
000560        03 COLUMN 6 PIC X(30) VALUE "TOTAL ACCOUNT BALANCE IS Rs. ".
000561        03 COLUMN 64 PIC Z(8)99.99 SUM TOTAL.
000562
000563 01  TYPE IS PAGE FOOTING.
000564     02 LINE IS 59.
000565        03 COLUMN 6 PIC X(76) VALUE ALL "#".
000566     02 LINE IS 60.
000567        03 COLUMN 6 PIC X(18) VALUE "SANDEEP KR SINGH ".
000568        03 COLUMN 64 PIC X(10) VALUE "PAGE NO. ".
000569        03 COLUMN 76 PIC Z9 SOURCE PAGE-COUNTER.
000570
000571
000572 RD  MY-ATM2
000573     CONTROL ARE FINAL, PGNO
000574     PAGE LIMIT IS 66
000575     HEADING 2
000576     FIRST DETAIL 12
000577     LAST DETAIL 50
000578     FOOTING 58.
000579 01  TYPE IS PAGE HEADING.
000580     02 LINE 2.
000581        03 COLUMN 10 PIC X(10) VALUE "NAME :".
000582        03 COLUMN 22 PIC X(10) SOURCE TEM-NAME.
000583     02 LINE 3.
000584
000585        03 COLUMN 10 PIC X(6) VALUE "AGE :".
000586        03 COLUMN 22 PIC X(2) SOURCE TEM-AGE.
000587     02 LINE 4.
000588        03 COLUMN 10 PIC X(10) VALUE "DATE :".
000589        03 COLUMN 22 PIC X(10) SOURCE THE-D.
000590
000591     02 LINE 5.
000592        03 COLUMN 34 PIC X(28) VALUE "STATEMENTS OF ACCOUNTS".
000593     02 LINE 6.
000594        03 COLUMN 6 PIC X(78) VALUE ALL "#".
000595     02 LINE 8.
000596        03 COLUMN 6 PIC X(4) VALUE "SLNO".
000597        03 COLUMN 11 PIC X(8) VALUE "  DATE  ".
000598        03 COLUMN 19 PIC X(5) VALUE " TIME".
000599        03 COLUMN 25 PIC X(9) VALUE "STATEMENT".
000600        03 COLUMN 35 PIC X(14) VALUE "DEPOSIT AMOUNT".
000601        03 COLUMN 50 PIC X(14) VALUE "WITHDRAWL AMT".
000602        03 COLUMN 65 PIC X(14) VALUE "  NET-BALANCE".
000603     02 LINE 9.
000604        03 COLUMN 6 PIC X(78) VALUE ALL "#".
000605
000606
000607 01  DETAIL2 TYPE IS DETAIL .
000608     02 LINE IS PLUS 1.
000609        03 COLUMN 6 PIC Z9 SOURCE PGNO.
000610        03 COLUMN 11 PIC X(8) SOURCE DATE22.
000611        03 COLUMN 20 PIC X(5) SOURCE TIME22.
000612        03 COLUMN 26 PIC X(9) SOURCE STATE1.
000613        03 COLUMN 35 PIC Z(8)99.99 SOURCE M2-SAV.
000614        03 COLUMN 50 PIC Z(8)99.99 SOURCE M2-WITH.
000615        03 COLUMN 65 PIC Z(8)99.99 SOURCE M2-TOTAL.
000616
000617 01  TYPE IS CONTROL FOOTING PGNO NEXT GROUP PLUS 1.
000618     02 LINE PLUS 1.
000619        03 COLUMN 6 PIC X VALUE " ".
000620 01  TYPE IS CONTROL FOOTING FINAL.
000621         02 LINE IS PLUS 2.
000622        03 COLUMN 6 PIC X(30) VALUE "TOTAL ACCOUNT BALANCE IS Rs. ".
000623        03 COLUMN 64 PIC Z(8)99.99 SOURCE M2-TOTAL.
000624
000625 01  TYPE IS PAGE FOOTING.
000626     02 LINE IS 59.
000627        03 COLUMN 6 PIC X(78) VALUE ALL "#".
000628     02 LINE IS 60.
000629        03 COLUMN 6 PIC X(18) VALUE "SANDEEP KR SINGH ".
000630        03 COLUMN 64 PIC X(10) VALUE "PAGE NO. ".
000631        03 COLUMN 76 PIC Z9 SOURCE PAGE-COUNTER.
000632
000633
000634
000635
000636 PROCEDURE DIVISION.
000637 MAIN-LOGIC SECTION.
000638 PROGRAM-BEGIN.
000639
000640     ACCEPT THE FROM DATE.
000641     MOVE YY TO YYP.
000642     MOVE MM TO MMP.
000643     MOVE DD TO DDP.
000644
000645     EXEC SQL CONNECT TO MYODBC2.
000646     PERFORM OPENNING.
000647
000648     PERFORM WELLCOME.
000649     PERFORM MAIN-PAGE.
000650*     PERFORM THE-CORE.
000651
000652     PERFORM THANKS.
000653
000654 PROGRAM-DONE.
000655     STOP RUN.
000656
000657 OPENNING.
000658
000659     OPEN I-O LOGIN-TABLE1.
000660     OPEN I-O MAIN-TABLE1.
000661     OPEN OUTPUT PRINTFILE.
000662
000663
000664 CLOSING.
000665
000666     CLOSE LOGIN-TABLE1.
000667
000668     CLOSE MAIN-TABLE1.
000669     CLOSE PRINTFILE.
000670
000671
000672 WELLCOME.
000673* INITIALIZE. IST WELLCOME PAGE HERE. IT WILL ASK TO ENTER CHOSE
PASSWORD
000674* OR NEW USER. AND GET THE L-CHOICE. VALIDATION OF L-CHOICE.
000675     MOVE SPACE TO SURE.
000676     MOVE ZERO TO L-CHOICE.
000677     DISPLAY SP3 .
000678     DISPLAY SP-D.
000679     DISPLAY SP3 SP6 "WELLCOME TO MY ATM".
000680     DISPLAY SP-D.
000681     DISPLAY SP3.
000682     DISPLAY SP3 " CHOSE ANY ONE OPTION :".
000683     DISPLAY SP3.
000684     DISPLAY SP6 " 1   ENTER YOUR PASSWORD".
000685     DISPLAY SP6 " 2   NEW USER".
000686     DISPLAY SP3.
000687     DISPLAY SP3 " 0   EXIT".
000688     DISPLAY SP3.
000689     DISPLAY SP3 " YOUR CHOICE IS : ".
000690     ACCEPT L-CHOICE.
000691     DISPLAY SP3.
000692     DISPLAY SP3 " IS YOUR CHOICE CORRECT : ".
000693     ACCEPT SURE.
000694     IF L-CHOICE = ZERO
000695     PERFORM THANKS.
000696     IF L-CHOICE < 0 OR L-CHOICE > 2
000697     DISPLAY " INVALID CHOICE ...TRY AGAIN"
000698     PERFORM WELLCOME.
000699     IF SURE = "N" OR SURE = "n" AND L-CHOICE NOT = ZERO
000700     PERFORM WELLCOME.
000701     PERFORM LOGIN.
000702
000703
000704 LOGIN.
000705* NEW USER--REGISTER. OLD--CHECK LOGIN. STOR INFO.
000706
000707     IF L-CHOICE = 1
000708     PERFORM MAKE-TAB
000709     PERFORM ASK-PASS
000710     PERFORM CHECK-PASS.
000711     IF L-CHOICE = 2
000712     OPEN EXTEND MAIN3
000713     MOVE SPACE TO DDD
000714     PERFORM REGISTER UNTIL DDD = "N" OR DDD = "n"
000715     CLOSE MAIN3
000716     DISPLAY " THANK YOU ..YOU ARE REGISTERED. PROGRAM IS CLOSING
DOWN. RESTART IT."
000717     PERFORM THANKS.
000718
000719
000720
000721 MAIN-PAGE.
000722* SHOW MAIN PAGE. ACCEPT CHOICE.
000723
000724
000725     MOVE ZERO TO CHOICE, L-CHOICE.
000726     PERFORM LN 7 TIMES.
000727     DISPLAY SP-D.
000728     DISPLAY SP3 "WELLCOME " TEM-NAME.
000729     DISPLAY SP3.
000730     DISPLAY SP3.
000731     DISPLAY SP6 " 1  AMOUNT SAVING".
000732     DISPLAY SP6 " 2  AMOUNT WITHDRAW".
000733     DISPLAY SP6 " 3  SHOW BALANCE".
000734     DISPLAY SP6 " 4  GENERATE REPORT".
000735     DISPLAY SP6 " 5  PRINT REPORT".
000736     DISPLAY SP6 " 6  YOUR STATEMENTS OF ACCOUNT".
000737     DISPLAY SP3.
000738     DISPLAY SP6 " 7  EXIT".
000739     DISPLAY SP6.
000740     DISPLAY SP6.
000741     DISPLAY SP-D.
000742     DISPLAY SP3 " YOUR CHOICE IS : ".
000743     ACCEPT CHOICE.
000744     PERFORM CH-VALIDATION.
000745
000746 CH-VALIDATION.
000747     IF CHOICE > 0 AND CHOICE < 8
000748     DISPLAY " YOUR CHOICE  " CHOICE " IS OK"
000749     PERFORM THE-CORE
000750     ELSE
000751     DISPLAY " INVALID CHOICE. TRY AGAIN."
000752     PERFORM MAIN-PAGE.
000753
000754
000755
000756
000757
000758 THE-CORE.
000759* MAIN PROCESSING BODY.
000760     IF CHOICE = 1 OR CHOICE = 2
000761        PERFORM A-SAVING
000762        PERFORM CALCULATION
000763        PERFORM MAIN-PAGE.
000764     IF CHOICE = 3
000765        PERFORM A-BAL
000766        DISPLAY SP3
000767        DISPLAY " COLLECT YOUR MONEY (Enter any key to proceed..).
"000768        ACCEPT AG
000769        PERFORM MAIN-PAGE.
000770     IF CHOICE = 4
000771        PERFORM G-P-REPORT
000772        DISPLAY " WANT TO GO BACK TO MAIN PAGE (ENTER ANY CHARACTER ). "
000773        ACCEPT AG
000774        PERFORM MAIN-PAGE.
000775     IF CHOICE = 5
000776        PERFORM PRINT
000777        PERFORM MAIN-PAGE.
000778     IF CHOICE = 6
000779        PERFORM STATEMENT-OF-ACC
000780        PERFORM MAIN-PAGE.
000781     IF CHOICE = 7
000782        PERFORM THANKS.
000783
000784
000785 A-SAVING.
000786
000787     MOVE ZERO TO AMT-S.
000788     MOVE "Y" TO SURE.
000789     PERFORM LN 14 TIMES.
000790     DISPLAY SP-D.
000791     IF CHOICE = 1
000792     DISPLAY SP3 "ENTER THE AMOUNT FOR SAVING IN YOUR ACCOUNT (0-999,999.99): ".
000793     IF CHOICE = 2
000794     DISPLAY SP3 "ENTER THE AMOUNT FOR WITHDRAWAL FROM YOUR ACCOUNT (0-999,999.99): ".
000795
000796     DISPLAY SP-D.
000797     DISPLAY SP3 "(Enter zero to end)".
000798     DISPLAY "Rs. ".
000799     ACCEPT AMT-S.
000800     DISPLAY SP3 " ARE YOU CORRECT ( Y OR N ) :".
000801     ACCEPT SURE.
000802     IF SURE = "N" OR SURE = "n"
000803     PERFORM A-SAVING.
000804     IF AMT-S = ZERO
000805     PERFORM MAIN-PAGE.
000806
000807     PERFORM AMT-VAL.
000808
000809
000810 AMT-VAL.
000811     IF AMT-S < 1 OR AMT-S > 999999.99
000812          DISPLAY SP3 "INVALID AMOUNT.. TRY AGAIN..."
000813          PERFORM A-SAVING
000814     ELSE
000815          DISPLAY SP3 " YOUR TRANSACTION COMPLETED SUCCESSFULLY.".
000816
000817 CALCULATION.
000818     OPEN EXTEND MAIN3.
000819     MOVE ZERO TO PASSWD, TOTAL, M2-PASSWD, M2-SAV, M2-WITH,M2-TOTAL, T1-DATE, T1-TIME.
000820     MOVE ZERO TO BAL-OK.
000821     ACCEPT T1-DATE FROM DATE.
000822     ACCEPT T1-TIME FROM TIME.
000823     MOVE T1-DATE TO M2-DT.
000824     MOVE T1-TIME TO M2-TIM.
000825     MOVE TEM-PASS TO PASSWD, M2-PASSWD.
000826     READ MAIN-TABLE1 RECORD INVALID KEY
000827     DISPLAY SP3 " YOUR ACCOUNT NOT FOUND ..SORRY"
000828     CLOSE MAIN3
000829     PERFORM WELLCOME.
000830     MOVE TOTAL TO TEM-TOTAL.
000831     IF TEM-TOTAL < MIN-BAL
000832     MOVE 1 TO BAL-OK.
000833
000834
000835     IF CHOICE = 1
000836        MOVE AMT-S TO M2-SAV
000837        COMPUTE NEW-TOTAL = TEM-TOTAL + AMT-S.
000838
000839     IF CHOICE = 2 AND BAL-OK = ZERO
000840        MOVE AMT-S TO M2-WITH
000841        COMPUTE NEW-TOTAL = TEM-TOTAL - AMT-S.
000842     IF CHOICE = 2 AND BAL-OK = 1
000843        DISPLAY " LOW BALANCE. YOU CANNOT WITHDRAW UNLESS YOU HAVE
MINIMUM BALANCE i.e." MIN-BAL
000844        PERFORM MAIN-PAGE.
000845
000846     MOVE NEW-TOTAL TO TOTAL, M2-TOTAL.
000847     MOVE TEM-PASS TO PASSWD, M2-PASSWD.
000848     WRITE M2-RECORDS.
000849     CLOSE MAIN3.
000850     REWRITE MAIN-RECORDS.
000851
000852
000853
000854 A-BAL.
000855
000856     MOVE TEM-PASS TO PASSWD.
000857     READ MAIN-TABLE1 RECORD INVALID KEY
000858     DISPLAY " CANNOT FIND OUT THE BALANCE.."
000859     PERFORM MAIN-PAGE.
000860     MOVE TOTAL TO D-TOTAL.
000861     DISPLAY SP3.
000862
000863     DISPLAY SP-D.
000864     DISPLAY SP-D.
000865
000866     DISPLAY SP3.
000867     DISPLAY SP3 " TODAYS DATE IS  :" THE-D.
000868     DISPLAY SP3.
000869     DISPLAY SP3 " YOUR INFORMATION :".
000870     DISPLAY SP3.
000871     DISPLAY SP3 " NAME : " TEM-NAME.
000872     DISPLAY SP3.
000873     DISPLAY SP3 " AGE : " TEM-AGE.
000874     DISPLAY SP3.
000875     DISPLAY SHOW-BAL .
000876     DISPLAY SP-D.
000877     DISPLAY SP-D.
000878
000879     IF TOTAL < 1000
000880     DISPLAY " YOUR BALANCE IS LESS THAN MINIMUM BALANCE.. you
cannot withdraw any more... "
000881     DISPLAY " TO GO BACK TO MAIN PAGE ENTER ANY CHARACTER . "
000882     ACCEPT AG
000883     PERFORM MAIN-PAGE.
000884
000885
000886
000887 G-P-REPORT.
000888
000889     MOVE "N" TO END-OF-FILE.
000890     MOVE ZERO TO NO-OF-PERSON, FLAG, TOTAL-BAL.
000891     MOVE 1 TO I.
000892     SET SII TO 1.
000893     PERFORM G-P-R UNTIL END-OF-FILE = "Y".
000894     SET SII TO 1.
000895     MOVE TOTAL-B TO TOTAL-BAL.
000896     PERFORM G-P-R-1 UNTIL FLAG = 1.
000897     MOVE "N" TO END-OF-FILE.
000898     PERFORM CLOSING.
000899     PERFORM OPENNING.
000900     DISPLAY SP3.
000901     DISPLAY "              ##### ACCOUNT - REPORT #####  ".
000902     DISPLAY SP3.
000903     DISPLAY SP3 " TODAYS DATE IS  :" THE-D.
000904
000905     PERFORM G-P-R-2 UNTIL END-OF-FILE = "Y".
000906     DISPLAY SP3.
000907
000908 G-P-R-1.
000909     SEARCH RR-MAIN
000910     AT END MOVE 1 TO FLAG
000911     WHEN RRTOTAL (SII) < 1000.00 AND RRTOTAL (SII) > 0
000912     ADD 1 TO NO-OF-PERSON
000913     SET SII UP BY 1.
000914
000915
000916 G-P-R.
000917
000918     READ MAIN-TABLE1 NEXT RECORD
000919     AT END
000920     MOVE "Y" TO END-OF-FILE.
000921     IF END-OF-FILE NOT = "Y"
000922     MOVE PASSWD TO RRPASSWD (SII)
000923     MOVE TOTAL TO RRTOTAL (SII)
000924     ADD TOTAL TO TOTAL-B.
000925     IF END-OF-FILE NOT = "Y" AND SII < 20
000926     SET SII UP BY 1.
000927
000928 G-P-R-2.
000929*     PERFORM CLOSING.
000930     MOVE SPACE TO LOGIN-RECORDS, MAIN-RECORDS.
000931*     PERFORM OPENNING.
000932     READ MAIN-TABLE1 NEXT RECORD AT END MOVE "Y" TO END-OF-FILE.
000933     IF END-OF-FILE NOT = "Y"
000934     MOVE PASSWD TO LPASSWD
000935     MOVE TOTAL TO DIS-TOT.
000936
000937     READ LOGIN-TABLE1 RECORD INVALID KEY GO TO JUST-GO.
000938     MOVE LNAME TO DIS-NAME.
000939     MOVE LAGE TO DIS-AGE.
000940     IF CHOICE = 4
000941      DISPLAY SP-D
000942      DISPLAY DIS-REPORT
000943      DISPLAY SP3
000944      DISPLAY SP-D
000945      DISPLAY SP3.
000946
000947 JUST-GO.
000948     DISPLAY SP3.
000949     DISPLAY " TOTAL ACCOUNT BALANCE IS : " TOTAL-BAL.
000950
000951     DISPLAY "TOTAL NUMBER OF PERSONS BELOW THE MINIMUM BALANCE
ARE
:  " NO-OF-PERSON.
000952     DISPLAY SP3.
000953     DISPLAY " WANT TO GO BACK TO MAIN PAGE (ENTER ANY CHARACTER ).".
000954     ACCEPT AG.
000955     PERFORM MAIN-PAGE.
000956
000957
000958
000959 THANKS.
000960* GOOD BYE...
000961     DISPLAY "THANKS FOR VISITING......GOOD BYE".
000962     PERFORM CLOSING.
000963     PERFORM PROGRAM-DONE.
000964
000965
000966 ASK-PASS.
000967     MOVE ZERO TO PASS1.
000968     DISPLAY SP3 " ENTER YOUR PASSWORD (ONLY 4 DIGIT): ".
000969     DISPLAY SP3 "ONLY FIRST 4 DIGIT WILL BE CONSIDERED".
000970     ACCEPT PASS1.
000971     DISPLAY SP3 " IS THE PASSWORD CORRECT ( Y OR N) ?".
000972     DISPLAY SP3 " (TO EXIT ENTER 'E' ) ".
000973
000974     ACCEPT OK1.
000975     IF ( OK1 = "N" OR OK1 = "n" ) OR ( PASS1 > 9999 OR PASS1 < 0 )
000976         PERFORM ASK-PASS
000977          PERFORM MAKE-TAB.
000978     IF OK1 = "E" OR OK1 = "e"
000979         PERFORM THANKS.
000980
000981
000982 MAKE-TAB.
000983
000984     MOVE "N" TO END-OF-FILE.
000985     SET SI TO 1.
000986     PERFORM MAKE1 UNTIL END-OF-FILE = "Y".
000987
000988 MAKE1.
000989
000990     READ LOGIN-TABLE1 NEXT RECORD
000991     AT END
000992     MOVE "Y" TO END-OF-FILE.
000993     IF END-OF-FILE NOT = "Y"
000994     MOVE LPASSWD TO TPASSWD (SI)
000995     MOVE LNAME TO TNAME (SI)
000996     MOVE LAGE TO TAGE (SI).
000997     IF END-OF-FILE NOT = "Y" AND SI < 20
000998     SET SI UP BY 1.
000999
001000
001001 CHECK-PASS.
001002
001003     MOVE ZERO TO OK2.
001004     SET SI TO 1.
001005        SEARCH TAB
001006        AT END MOVE 1 TO OK2
001007        WHEN PASS1 = TPASSWD (SI)
001008
001009        DISPLAY " PASSWORD IS CORRECT . YOU ARE LOGGED IN."
001010        MOVE TPASSWD (SI) TO TEM-PASS
001011        MOVE TNAME (SI) TO TEM-NAME
001012        MOVE TAGE (SI) TO TEM-AGE.
001013
001014
001015     IF OK2 = 1
001016        DISPLAY " INCORRECT PASSWORD . TRY AGAIN..."
001017        PERFORM ASK-PASS.
001018
001019 REGISTER.
001020     MOVE SPACE TO DDD.
001021     MOVE ZERO TO M2-WITH.
001022     PERFORM GET-FIELDS.
001023     MOVE REG-PASS TO LPASSWD, M2-PASSWD.
001024     MOVE REG-NAME TO LNAME.
001025     MOVE REG-AGE TO LAGE.
001026     WRITE LOGIN-RECORDS.
001027     MOVE ZERO TO MAIN-RECORDS.
001028     MOVE REG-PASS TO PASSWD.
001029     MOVE REG-SAV TO TOTAL, M2-SAV, M2-TOTAL.
001030     ACCEPT M2-DT FROM DATE.
001031     ACCEPT M2-TIM FROM TIME.
001032     WRITE M2-RECORDS.
001033     WRITE MAIN-RECORDS.
001034     DISPLAY " WANT TO DO MORE REGISTRATION : ( Y OR N )".
001035     ACCEPT DDD.
001036
001037 GET-FIELDS.
001038     MOVE SPACE TO SURE.
001039     DISPLAY SP3 " ENTER YOUR NAME ( ONLY FIRST 10 CHARACTERS
WILL
BE ACCEPTED ): ".
001040     ACCEPT REG-NAME.
001041     DISPLAY SP3 " ENTER YOUR AGE (ONLY FIRST 2 -DIGIT WILL BE
ACCEPTED ): ".
001042
001043     ACCEPT REG-AGE.
001044     DISPLAY SP3 " ENTER THE INITIAL AMOUNT TO BE DEPOSITED: ".
001045     ACCEPT REG-SAV.
001046
001047     DISPLAY SP3 " ENTER YOUR PASSWORD ( 4 DIGIT ONLY ) ".
001048     ACCEPT REG-PASS.
001049     DISPLAY SP3 " ARE YOU SURE ( Y OR N ). TO EXIT ENTER 'E' :".
001050     ACCEPT SURE.
001051     IF SURE = "E" PERFORM THANKS.
001052     IF REG-PASS < 0 OR REG-PASS > 9999
001053     DISPLAY SP3 " INVALID PASSWORD... TRY AGAIN"
001054     PERFORM GET-FIELDS.
001055     IF SURE = "Y" OR SURE = "y"
001056     PERFORM SRCH
001057     ELSE
001058     PERFORM GET-FIELDS.
001059
001060 SRCH.
001061
001062     MOVE ZERO TO OK2.
001063     SET SI TO 1.
001064        SEARCH TAB
001065        AT END MOVE 1 TO OK2
001066        WHEN REG-PASS = TPASSWD (SI)
001067        DISPLAY " PASSWORD ALREADY EXIST . TRY AGAIN."
001068        PERFORM GET-FIELDS.
001069
001070 LN.
001071     DISPLAY SP3.
001072
001073 PRINT.
001074
001075     PERFORM CLOSING.
001076     PERFORM OPENNING.
001077     MOVE ZERO TO END-OF-FILE, LES, TOTAL.
001078     MOVE 1 TO PGNO.
001079     INITIATE MY-ATM.
001080     PERFORM REP UNTIL END-OF-FILE = 1.
001081     SUBTRACT 1 FROM PGNO.
001082     TERMINATE MY-ATM.
001083     DISPLAY " GO AND COLLECT THE REPORT.  ENTER ANY KEY.....".
001084
001085     ACCEPT DDD.
001086
001087
001088 REP.
001089     READ LOGIN-TABLE1 NEXT RECORD AT END MOVE 1 TO END-OF-FILE.
001090     READ MAIN-TABLE1 NEXT RECORD AT END MOVE 1 TO END-OF-FILE.
001091
001092     IF END-OF-FILE NOT = 1
001093     PERFORM REP1.
001094
001095 REP1.
001096
001097     IF TOTAL < 1000.00 AND TOTAL > -1
001098     MOVE "BAD" TO STT
001099     ADD 1 TO LES
001100     ELSE
001101     MOVE "OK" TO STT.
001102     GENERATE DETAIL1.
001103
001104     ADD 1 TO PGNO.
001105
001106
001107 STATEMENT-OF-ACC.
001108
001109
001110     OPEN I-O MAIN3.
001111     OPEN OUTPUT PRINT2FILE.
001112     MOVE ZERO TO END-OF-FILE, LES, TOTAL.
001113     MOVE 1 TO PGNO.
001114     INITIATE MY-ATM2.
001115     PERFORM REP7 UNTIL END-OF-FILE = 1.
001116     SUBTRACT 1 FROM PGNO.
001117     TERMINATE MY-ATM2.
001118     CLOSE MAIN3, PRINT2FILE.
001119     DISPLAY " GO AND COLLECT THE REPORT.  ENTER ANY KEY.....".
001120
001121     ACCEPT DDD.
001122
001123
001124 REP7.
001125*     READ LOGIN-TABLE1 AT END MOVE 1 TO END-OF-FILE.
001126     READ MAIN3 AT END MOVE 1 TO END-OF-FILE.
001127     MOVE M2-DT TO DATE11.
001128     MOVE M2-TIM TO TIME11.
001129     MOVE YY11 TO YY22.
001130     MOVE MM11 TO MM22.
001131     MOVE DD11 TO DD22.
001132     MOVE HH11 TO HH22.
001133     MOVE MO11 TO MO22.
001134     IF M2-SAV = ZERO
001135     MOVE "withdrawn" TO STATE1.
001136     IF M2-WITH = ZERO
001137     MOVE "deposited" TO STATE1.
001138     IF END-OF-FILE NOT = 1
001139     PERFORM REP9.
001140
001141 REP9.
001142
001143     IF M2-PASSWD = TEM-PASS
001144     GENERATE DETAIL2
001145
001146     ADD 1 TO PGNO.
001147
001148* PROCEDURE DIVISION.
001149
001150* PROGRAM-START.
001151
001152*     OPEN I-O MAIN-TABLE1.
001153*     MOVE ZERO TO PASSWD, TOTAL.
001154*     MOVE SPACE TO LNAME, LAGE.
001155*     MOVE 4420 TO PASSWD.
001156*     MOVE 2000 TO TOTAL.
001157*     MOVE "SINGH" TO LNAME.
001158*     MOVE "21" TO LAGE.
001159*     WRITE MAIN-RECORDS.
001160*     READ MAIN-TABLE1 NEXT RECORD AT END DISPLAY " FINISH".
001161*     DISPLAY MAIN-RECORDS.
001162*     CLOSE MAIN-TABLE1.
001163
001164* PROGRAM-STOP.
001165*     STOP RUN.
001166

0 comments:

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