IDENTIFICATION DIVISION.
PROGRAM-ID. BANKTRAN.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT FILE1 ASSIGN TO DD1
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS LOG
FILE STATUS IS FS.
DATA DIVISION.
FILE SECTION.
FD FILE1.
01 BK.
02 LOG PIC X(29).
WORKING-STORAGE SECTION.
01 ACC.
02 ACCNO PIC X(10).
02 YEAR PIC X(4).
02 MON PIC X(2).
02 DY PIC X(2).
02 TNXNO PIC X(2).
02 TNX PIC X(2).
02 TNXAMT PIC 9(5)V99.
77 FLAG PIC X VALUE 'Y'.
77 FS PIC X(2).
77 INP PIC X(29).
PROCEDURE DIVISION.
MAIN-RTN.
OPEN INPUT FILE1.
DISPLAY FS.
ACCEPT LOG.
PERFORM READ-SEQ UNTIL FLAG = 'N'.
CLOSE FILE1.
DISPLAY FS.
STOP RUN.
READ-SEQ.
START FILE1 KEY IS >= LOG.
READ FILE1 NEXT AT END MOVE 'N' TO FLAG END-READ.
DISPLAY BK SPACE FS.
PROGRAM-ID. BANKTRAN.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT FILE1 ASSIGN TO DD1
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS LOG
FILE STATUS IS FS.
DATA DIVISION.
FILE SECTION.
FD FILE1.
01 BK.
02 LOG PIC X(29).
WORKING-STORAGE SECTION.
01 ACC.
02 ACCNO PIC X(10).
02 YEAR PIC X(4).
02 MON PIC X(2).
02 DY PIC X(2).
02 TNXNO PIC X(2).
02 TNX PIC X(2).
02 TNXAMT PIC 9(5)V99.
77 FLAG PIC X VALUE 'Y'.
77 FS PIC X(2).
77 INP PIC X(29).
PROCEDURE DIVISION.
MAIN-RTN.
OPEN INPUT FILE1.
DISPLAY FS.
ACCEPT LOG.
PERFORM READ-SEQ UNTIL FLAG = 'N'.
CLOSE FILE1.
DISPLAY FS.
STOP RUN.
READ-SEQ.
START FILE1 KEY IS >= LOG.
READ FILE1 NEXT AT END MOVE 'N' TO FLAG END-READ.
DISPLAY BK SPACE FS.
and my input file is
13106125952011081601CR1000000
13106125952011081602CR1100000
13106125952011081603CR1200000
13106125952011081604DB0100000
13106125952011081605DB0300000
13106125952011081606DB1100000
13106125952011081701DB1100000
13106125952011081801DB1100000
13106125952011081901DB1100000
13106125952011082601CR1100000
13106125952011082801CR1200000
13106125962011081701DB1100000
13106125962011081801DB1100000
13106125962011081901DB1100000
13106125972011081701DB1100000
13106125952011081602CR1100000
13106125952011081603CR1200000
13106125952011081604DB0100000
13106125952011081605DB0300000
13106125952011081606DB1100000
13106125952011081701DB1100000
13106125952011081801DB1100000
13106125952011081901DB1100000
13106125952011082601CR1100000
13106125952011082801CR1200000
13106125962011081701DB1100000
13106125962011081801DB1100000
13106125962011081901DB1100000
13106125972011081701DB1100000
when givem a key/partial key the read should be random first and then sequential as like reading all the bank statements in 6th month.
can any one help me out...