Brenda
2012-09-30 06:46:55 UTC
AUTHOR. BRENDA STRUB
PROGRAM-ID. BSprogram4.
DATE-WRITTEN. 9/15/2012.
DATE-COMPILED. 9/29/2012.
SECURITY. HIGH-SECURITY.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUST-FILE
ASSIGN TO
"C:\COBOLFILES\BSprogram4\CH0601 CUSTFILE.TXT"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT PRINT-FILE
ASSIGN TO
"C:\COBOLFILES\BSprogram4\CH0601 CUSTFOUT.TXT"
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD CUST-FILE
RECORD CONTAINS 24 CHARACTERS.
01 IN-CUSTOMER-REC.
05 INTIAL1 PIC X.
05 INTIAL2 PIC X.
05 LNAME PIC X(10).
05 MONTH-OF-TRANSACTION PIC X(2).
05 YEAR-OF-TRANSACTION PIC X(4).
05 TRANSACTION-AMT PIC 9(6).
FD PRINT-FILE.
01 OUT-CUSTOMER-REC PIC X(80).
WORKING-STORAGE SECTION.
01 WS-WORK-AREAS.
05 ARE-THERE-MORE-RECORDS PIC X(5) VALUE 'YES'.
01 HL-HEADER-1.
05 PIC X(5) VALUE SPACES.
05 PIC X(4) VALUE 'NAME'.
05 PIC X(5) VALUE SPACES.
05 PIC X(20) VALUE
'DATE OF TRANSACTIONS'.
05 PIC X(6) VALUE SPACES.
05 PIC X(21) VALUE
'AMOUNT OF TRANSACTION'.
01 SPACER.
05 PIC X(20) VALUE SPACES.
01 CUST-REC-LINE.
05 INTIAL1-OUT PIC X.
05 DECIMAL PIC X VALUE '.'.
05 INTIAL2-OUT PIC X.
05 DECIMAL2 PIC X VALUE '.'.
05 LNAME-OUT PIC X(10).
05 PIC X(6) VALUE SPACES.
05 MONTH-OF-TRANSACTION-OUT PIC X(2).
05 SLASH PIC X VALUE '/'.
05 YEAR-OF-TRANSACTION-OUT PIC X(4).
05 PIC X(12) VALUE SPACES.
05 TRANSACTION-AMT-OUT PIC $ZZZ,ZZ9.
PROCEDURE DIVISION.
100-MAIN-MODULE.
OPEN INPUT CUST-FILE
OUTPUT PRINT-FILE
WRITE OUT-CUSTOMER-REC FROM SPACER
WRITE OUT-CUSTOMER-REC FROM HL-HEADER-1
WRITE OUT-CUSTOMER-REC FROM SPACER
PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO'
READ CUST-FILE
AT END
MOVE 'NO' TO ARE-THERE-MORE-RECORDS
NOT AT END
PERFORM 200-CALC-RTN
END-READ
END-PERFORM
CLOSE CUST-FILE
PRINT-FILE
STOP RUN.
200-CALC-RTN.
MOVE INTIAL1 TO INTIAL1-OUT
MOVE INTIAL2 TO INTIAL2-OUT
MOVE LNAME TO LNAME-OUT
MOVE MONTH-OF-TRANSACTION TO MONTH-OF-TRANSACTION-OUT
MOVE YEAR-OF-TRANSACTION TO YEAR-OF-TRANSACTION-OUT
MOVE TRANSACTION-AMT TO TRANSACTION-AMT-OUT
WRITE OUT-CUSTOMER-REC FROM CUST-REC-LINE.
end program BSprogram4.