**PICK A FIELD FROM PS, MATCH WITH KSDS KEY,
**DISPLAY IN SPOOL
IDENTIFICATION DIVISION.
PROGRAM-ID. KSD.
AUTHOR. SRIBLOG.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT BIK ASSIGN TO DD1
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL
FILE STATUS IS WS-BIK.
SELECT KSDS ASSIGN TO DD2
ORGANIZATION IS INDEXED
ACCESS IS RANDOM
FILE STATUS IS WS-KSDS
RECORD KEY KSDS-REG.
DATA DIVISION.
FILE SECTION.
FD BIK.
01 BIK-REC.
05 BIK-KEY PIC 9(4) .
05 FILLER PIC X(76).
FD KSDS.
01 KSDS-REC.
05 KSDS-REG PIC 9(4).
05 FILLER PIC X.
05 KSDS-NAME PIC X(17).
05 FILLER PIC X(2).
05 KSDS-COUNTRY PIC X(5).
05 FILLER PIC X.
05 KSDS-STATE PIC X(13).
05 FILLER PIC X(2).
05 KSDS-SALARY PIC 9(4).
05 FILLER PIC X(31).
WORKING-STORAGE SECTION.
01 VARIABLES.
05 WS-BIK PIC 9(2).
88 SUCCESS-BIK VALUE 00.
88 EOF-BIK VALUE 10.
05 WS-KSDS PIC 9(2).
88 SUCCESS-KSDS VALUE 00.
88 EOF-KSDS VALUE 10.
88 KNF-KSDS VALUE 23.
PROCEDURE DIVISION.
0000-MAIN-PARA.
PERFORM 1000-INITIALIZATION-PARA
THRU 1000-INITIALIZATION-PARA-EXIT
PERFORM 2000-PROCESS-PARA
THRU 2000-PROCESS-PARA-EXIT
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
.
0000-MAIN-PARA-EXIT.
EXIT
.
1000-INITIALIZATION-PARA.
.
1000-INITIALIZATION-PARA-EXIT.
EXIT
.
2000-PROCESS-PARA.
PERFORM 2100-OPEN-PARA
THRU 2100-OPEN-PARA-EXIT
PERFORM 2100-READ-PARA
THRU 2100-READ-PARA-EXIT
UNTIL EOF-BIK
PERFORM 2100-CLOSE-PARA
THRU 2100-CLOSE-PARA-EXIT
.
2000-PROCESS-PARA-EXIT.
EXIT
.
2100-OPEN-PARA.
OPEN INPUT BIK
EVALUATE TRUE
WHEN SUCCESS-BIK
CONTINUE
WHEN OTHER
DISPLAY WS-BIK
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
END-EVALUATE
OPEN INPUT KSDS
EVALUATE TRUE
WHEN SUCCESS-KSDS
CONTINUE
WHEN OTHER
DISPLAY WS-KSDS
CLOSE BIK
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
END-EVALUATE
.
2100-OPEN-PARA-EXIT.
EXIT
.
2100-READ-PARA.
READ BIK
EVALUATE TRUE
WHEN SUCCESS-BIK
CONTINUE
WHEN EOF-BIK
CLOSE BIK
CLOSE KSDS
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
WHEN OTHER
DISPLAY 'READ ERROR' WS-BIK
CLOSE BIK
CLOSE KSDS
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
END-EVALUATE
MOVE BIK-KEY TO KSDS-REG
READ KSDS
EVALUATE TRUE
WHEN SUCCESS-KSDS
DISPLAY KSDS-REC
WHEN KNF-KSDS
DISPLAY 'KNF'
WHEN OTHER
DISPLAY 'WRITE ERROR' WS-KSDS
END-EVALUATE
.
2100-READ-PARA-EXIT.
EXIT
.
2100-CLOSE-PARA.
CLOSE BIK
CLOSE KSDS
.
2100-CLOSE-PARA-EXIT.
EXIT
.
9000-TERMINATION-PARA.
STOP RUN
.
9000-TERMINATION-PARA-EXIT.
EXIT
.
**DISPLAY IN SPOOL
IDENTIFICATION DIVISION.
PROGRAM-ID. KSD.
AUTHOR. SRIBLOG.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT BIK ASSIGN TO DD1
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL
FILE STATUS IS WS-BIK.
SELECT KSDS ASSIGN TO DD2
ORGANIZATION IS INDEXED
ACCESS IS RANDOM
FILE STATUS IS WS-KSDS
RECORD KEY KSDS-REG.
DATA DIVISION.
FILE SECTION.
FD BIK.
01 BIK-REC.
05 BIK-KEY PIC 9(4) .
05 FILLER PIC X(76).
FD KSDS.
01 KSDS-REC.
05 KSDS-REG PIC 9(4).
05 FILLER PIC X.
05 KSDS-NAME PIC X(17).
05 FILLER PIC X(2).
05 KSDS-COUNTRY PIC X(5).
05 FILLER PIC X.
05 KSDS-STATE PIC X(13).
05 FILLER PIC X(2).
05 KSDS-SALARY PIC 9(4).
05 FILLER PIC X(31).
WORKING-STORAGE SECTION.
01 VARIABLES.
05 WS-BIK PIC 9(2).
88 SUCCESS-BIK VALUE 00.
88 EOF-BIK VALUE 10.
05 WS-KSDS PIC 9(2).
88 SUCCESS-KSDS VALUE 00.
88 EOF-KSDS VALUE 10.
88 KNF-KSDS VALUE 23.
PROCEDURE DIVISION.
0000-MAIN-PARA.
PERFORM 1000-INITIALIZATION-PARA
THRU 1000-INITIALIZATION-PARA-EXIT
PERFORM 2000-PROCESS-PARA
THRU 2000-PROCESS-PARA-EXIT
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
.
0000-MAIN-PARA-EXIT.
EXIT
.
1000-INITIALIZATION-PARA.
.
1000-INITIALIZATION-PARA-EXIT.
EXIT
.
2000-PROCESS-PARA.
PERFORM 2100-OPEN-PARA
THRU 2100-OPEN-PARA-EXIT
PERFORM 2100-READ-PARA
THRU 2100-READ-PARA-EXIT
UNTIL EOF-BIK
PERFORM 2100-CLOSE-PARA
THRU 2100-CLOSE-PARA-EXIT
.
2000-PROCESS-PARA-EXIT.
EXIT
.
2100-OPEN-PARA.
OPEN INPUT BIK
EVALUATE TRUE
WHEN SUCCESS-BIK
CONTINUE
WHEN OTHER
DISPLAY WS-BIK
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
END-EVALUATE
OPEN INPUT KSDS
EVALUATE TRUE
WHEN SUCCESS-KSDS
CONTINUE
WHEN OTHER
DISPLAY WS-KSDS
CLOSE BIK
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
END-EVALUATE
.
2100-OPEN-PARA-EXIT.
EXIT
.
2100-READ-PARA.
READ BIK
EVALUATE TRUE
WHEN SUCCESS-BIK
CONTINUE
WHEN EOF-BIK
CLOSE BIK
CLOSE KSDS
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
WHEN OTHER
DISPLAY 'READ ERROR' WS-BIK
CLOSE BIK
CLOSE KSDS
PERFORM 9000-TERMINATION-PARA
THRU 9000-TERMINATION-PARA-EXIT
END-EVALUATE
MOVE BIK-KEY TO KSDS-REG
READ KSDS
EVALUATE TRUE
WHEN SUCCESS-KSDS
DISPLAY KSDS-REC
WHEN KNF-KSDS
DISPLAY 'KNF'
WHEN OTHER
DISPLAY 'WRITE ERROR' WS-KSDS
END-EVALUATE
.
2100-READ-PARA-EXIT.
EXIT
.
2100-CLOSE-PARA.
CLOSE BIK
CLOSE KSDS
.
2100-CLOSE-PARA-EXIT.
EXIT
.
9000-TERMINATION-PARA.
STOP RUN
.
9000-TERMINATION-PARA-EXIT.
EXIT
.