What's new
  • Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Request Cobol Programming Transaction File

Shin Ryujin

Enthusiast
Established
Joined
Apr 26, 2017
Messages
118
Reaction score
16
Age
20
, Last edited:
PANO PO KAYA YUNG PROCESS RTN AT MAIN RTN, BREAK RTN di ko po alam ano ipeperform kong code eh since for a break siya.

For a break in account number, print account number, account name and balance. At end of file, print the Total Number of Records printed and Total Accumulates Balance of all records in the file. (Balance =Deposit – Withdrawal)4
Requirements:
Note: the file is sorted in ascending account number. There are two possible values of transaction code, ‘D’ for ‘Deposit’ and ‘W’ for withdrawal.’

IDENTIFICATION DIVISION.
PROGRAM-ID. TRANSAC.
*AUTHOR. Shin Ryujin.
*INSTALLATION. Houses.
*DATE-WRITTEN. August 8, 2019.
*DATE-COMPILED. August 9, 2019.
*SECURITY. EXCLUSIVE FOR MA'AM.
*REMARKS OKAY LANG PO.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. PC-ICY.
OBJECT-COMPUTER. PC-ICY.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO 'TRANSAC.TXT'.
SELECT OUTFILE ASSIGN TO 'CHILE.TXT'.
DATA DIVISION.
FILE SECTION.
FD INFILE
LABEL RECORD IS STANDARD
DATA RECORD IS INREC.
02 ACCNO PIC X(10).
02 ACCNA PIC X(25).
02 ACCBA PIC ZZZ,ZZZ,ZZ9,99.
FD OUTFILE
LABEL RECORD IS OMITTED
DATA RECORD IS OUTREC.
01 OUTREC.
02 FILLER PIC X(80).
WORKING-STORAGE SECTION.
01 SVACCNO PIC X(10) VALUE ZERO.
01 TNR PIC X VALUE ZERO.
01 TAB PIC 9(7) VALUE ZERO.
01 EOFSW 9 VALUE ZERO.
01 HEAD-1.
02 FILLER PIC X(32) VALUE SPACES.
02 FILLER PIC X(16) VALUE 'Chile Grand Bank '.
02 FILLER PIC X(32) VALUE SPACES.
01 HEAD-2.
02 FILLER PIC X(34) VALUE SPACES.
02 FILLER PIC X(13) VALUE 'Quezon Avenue'.
02 FILLER PIC X(33) VALUE SPACES.
02 FILLER PIC X(35) VALUE SPACES.
02 FILLER PIC X(11) VALUE 'Quezon City'.
02 FILLER PIC X(34) VALUE SPACES.
01 SUB-1.
02 FILLER PIC X(32) VALUE SPACES.
02 FILLER PIC X(16) VALUE 'Account's Report'.
02 FILLER PIC X(32) VALUE SPACES.
01 SUB-2.
02 FILLER PIC X(10) VALUE SPACES
02 FILLER PIC X(7) VALUE 'Account'.
02 FILLER PIC X(1) VALUE SPACES.
02 FILLER PIC X(9) VALUE SPACES.
02 FILLER PIC X(9) VALUE SPACES.
02 FILLER PIC X(7) VALUE 'Account'.
02 FILLER PIC X(9) VALUE SPACES.
02 FILLER PIC X(11) VALUE SPACES.
02 FILLER PIC X(7) VALUE 'Balance'.
02 FILLER PIC X(10) VALUE SPACES.
01 SUB-3.
02 FILLER PIC X(10) VALUE SPACES.
02 FILLER PIC X(8) VALUE 'Number'.
02 FILLER PIC X(9) VALUE SPACES.
02 FILLER PIC X(10) VALUE SPACES.
02 FILLER PIC X(4) VALUE 'Name'.
02 FILLER PIC X(11) VALUE SPACES.
01 PERSONALINFO.
02 FILLER PIC X(9) VALUE SPACES.
02 FILLER PIC X(11) VALUE SPACES.
02 FILLER PIC X(8) VALUE SPACES.
02 P-ACCNO PIC X(10).
02 FILLER PIC X(9) VALUE SPACES.
02 P-ACCNA PIC X(25).
02 FILLER PIC X(9) VALUE SPACES.
02 P-ACCBA PIC X(11).
02 FILLER PIC X(8) SPACES.
01 PARECORD.
02 FILLER PIC X(8) VALUE 'Total No'.
02 FILLER PIC X(13) VALUE 'Of Record:'.
02 FILLER PIC X(9) VALUE SPACES.
02 P-TNR PIC X.
02 FILLER PIC X(31) VALUE SPACES.
01 CHINGCHONGBAL.
02 FILLER PIC X(11) VALUE SPACES.
02 FILLER PIC X(6) VALUE 'TOTAL'.
02 FILLER PIC X(11) VALUE 'ACCUMULATED'.
02 FILLER PIC X(8) VALUE 'BALANCE:'.
02 FILLER PIC X(3) VALUE 'PHP'.
02 P-TAB PIC 9,999,999.
02 FILLER PIC X(33) VALUE SPACES.
SCREEN SECTION.
01 SCRE.
02 BLANK SCREEN.
PROCEDURE DIVISION.
MAIN-RTN.
PERFORM INIT-RTN THROUGH INIT-RTN-END.
PERFORM PROCESS-RTN UNTIL EOFSW = 1.
PERFORM FINISH-RTN.
STOP RUN.
INIT-RTN.
OPEN INPUT INFILE, OUTPUT OUTFILE.
READ INFILE AT END PERFORM END-RTN GO TO
INIT-RTN-END.
PERFORM HEADING-RTN.
INIT-RTN-END.
END-RTN.
MOVE 1 TO EOFSW.
DISPLAY 'ERROR' LINE 3 COLUMN 20.
HEADING-RTN.
WRITE OUTREC FROM HEAD-1 AFTER PAGE.
WRITE OUTREC FROM HEAD-2 AFTER ADVANCING 1 LINE.
WRITE OUTREC FROM SUB-1 AFTER 3.
WRITE OUTREC FROM SUB-2 AFTER 2.
WRITE OUTREC FROM SUB-3 AFTER 1.
PROCESS-RTN.
DISPLAY SCRE.
IF SVACCNO = ACCNO PERFORM BREAK-RTN ELSE NEXT SENTENCE.
READ INFILE AT END MOVE 1 TO EOFSW PERFORM BREAK-RTN.
BREAK-RTN.
MOVE SVACCNO TO P-ACCNO.
MOVE ACCNA TO P-ACCNA.
MOVE ACCBA TO P-ACCBA.
WRITE OUTREC FROM PERSONALINFO AFTER 1.
PERFORM FINISH-RTN.
FINISH-RTN.
MOVE TNS TO P-TNS.
WRITE OUTREC FROM TOTAL-1 AFTER 3.
MOVE TAB TO P-TAB.
MOVE 0 TO TNR, TAB.
MOVE AC TO SVAC.
WRITE OUTREC FROM TOTAL-2 AFTER 1.
CLOSE INFILE, OUTFILE.
DISPLAY 'THANK YOU FOR USING THE PROGRAM' LINE 7 COLUMN 18.
Output and Input Layout
 

Attachments

Trending Topics

Trending On This Forum

Unanswered Topics

Top