I have a piece of COBOL code which tend to write records from a flat file to a KSDS cluster. But unfortunately it writes only one record and other records are not written. I tried with File status it show 00 for both read and write. I'm attaching the code i have written. Please anyone help me where do i go wrong. Thanks a lot for your time. Apologies if m wrong.
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. PGM.
000300 ENVIRONMENT DIVISION.
000400 INPUT-OUTPUT SECTION.
000500 FILE-CONTROL.
000600 SELECT INFILE ASSIGN TO DD1
000700 ORGANIZATION IS SEQUENTIAL
000800 FILE STATUS IS FS1.
000900 SELECT OUTFILE ASSIGN TO DD2
001000 ORGANIZATION IS INDEXED
001100 RECORD KEY IS SNO1
001200 ACCESS IS SEQUENTIAL
001300 FILE STATUS IS FS2.
001400 DATA DIVISION.
001500 FILE SECTION.
001600 FD INFILE.
001700 01 STUD.
001800 02 SNO PIC 9(4).
001900 02 FILLER PIC X(5).
002000 02 SNAME PIC X(20).
002100 02 FILLER PIC X(5).
002200 02 SADDRE PIC X(30).
002300 02 FILLER PIC X(5).
002400 02 FILLER PIC X(11).
002500 FD OUTFILE.
002600 01 STUD1.
002700 02 SNO1 PIC 9(4).
002800 02 FILLER PIC X(5).
002900 02 SNAME1 PIC X(20).
003000 02 FILLER PIC X(5).
003100 02 SADDRE1 PIC X(30).
003200 02 FILLER PIC X(5).
003300 02 FILLER PIC X(11).
003400 WORKING-STORAGE SECTION.
003500 77 FS1 PIC 9(2).
003600 77 FS2 PIC 9(2).
003610 77 EOF PIC X(1) VALUE 'N'.
003800 PROCEDURE DIVISION.
004400 OPEN-PARA.
004500 OPEN INPUT INFILE.
004600 DISPLAY "OPEN INFILE:" FS1.
004700 OPEN OUTPUT OUTFILE.
004800 DISPLAY "OPEN OUTFILE:" FS2.
005500 READ-PARA.
005600 READ INFILE AT END MOVE ' Y ' TO EOF.
005800 DISPLAY "READ STATUS:"FS1.
005810 MOVE STUD TO STUD1.
005900 WRITE STUD1.
005910 DISPLAY "WRITE STATUS:"FS2.
006100 CLOSE-PARA.
006200 CLOSE INFILE.
006300 CLOSE OUTFILE.
006400 STOP RUN.
000200 PROGRAM-ID. PGM.
000300 ENVIRONMENT DIVISION.
000400 INPUT-OUTPUT SECTION.
000500 FILE-CONTROL.
000600 SELECT INFILE ASSIGN TO DD1
000700 ORGANIZATION IS SEQUENTIAL
000800 FILE STATUS IS FS1.
000900 SELECT OUTFILE ASSIGN TO DD2
001000 ORGANIZATION IS INDEXED
001100 RECORD KEY IS SNO1
001200 ACCESS IS SEQUENTIAL
001300 FILE STATUS IS FS2.
001400 DATA DIVISION.
001500 FILE SECTION.
001600 FD INFILE.
001700 01 STUD.
001800 02 SNO PIC 9(4).
001900 02 FILLER PIC X(5).
002000 02 SNAME PIC X(20).
002100 02 FILLER PIC X(5).
002200 02 SADDRE PIC X(30).
002300 02 FILLER PIC X(5).
002400 02 FILLER PIC X(11).
002500 FD OUTFILE.
002600 01 STUD1.
002700 02 SNO1 PIC 9(4).
002800 02 FILLER PIC X(5).
002900 02 SNAME1 PIC X(20).
003000 02 FILLER PIC X(5).
003100 02 SADDRE1 PIC X(30).
003200 02 FILLER PIC X(5).
003300 02 FILLER PIC X(11).
003400 WORKING-STORAGE SECTION.
003500 77 FS1 PIC 9(2).
003600 77 FS2 PIC 9(2).
003610 77 EOF PIC X(1) VALUE 'N'.
003800 PROCEDURE DIVISION.
004400 OPEN-PARA.
004500 OPEN INPUT INFILE.
004600 DISPLAY "OPEN INFILE:" FS1.
004700 OPEN OUTPUT OUTFILE.
004800 DISPLAY "OPEN OUTFILE:" FS2.
005500 READ-PARA.
005600 READ INFILE AT END MOVE ' Y ' TO EOF.
005800 DISPLAY "READ STATUS:"FS1.
005810 MOVE STUD TO STUD1.
005900 WRITE STUD1.
005910 DISPLAY "WRITE STATUS:"FS2.
006100 CLOSE-PARA.
006200 CLOSE INFILE.
006300 CLOSE OUTFILE.
006400 STOP RUN.
Regards,
Viswa.