Not only in CICS, in any of the mainframe Technologies, but the reading of the files can also be done in multiple ways.
Sequential &
Random Access
Especially in CICS, Sequential and Random access are most popular ways of reading files.
Sequential Access: STARTBR (start browse) keeps record at the key position, from where we want to read a record.
READNEXT-will actually read the record into working storage file description area.
Sample syntax:
EXEC CICS STARTBR
DATASET('FILEAA')
RIDFILD(REC-IO-KEY)==> Record Key
GTEQ
END-EXEC.
—-
EXEC CICS READNEXT
DATASET('FILEAA')
INTO(FILE-IO-AREA) ==working storage file description at '01' level
RIDFILD(REC-IO-KEY)==>Record Key
GTEQ
END-EXEC.
Random Access: File reading by this way will be achieved with “READ” command. It reads the record, as per key mentioned, and moves into working storage record area.
Sample syntax:
EXEC CICS READ
DATASET('FILEAA')
INTO(FILE-IO-AREA) ==working storage file description at '01' level
RIDFILD(REC-IO-KEY)==>Record Key
GTEQ
END-EXEC.
These may look simple, but, many people do not have much idea. I am sure it will help you.
In my next posts, I will give how data will be retrieved by using DB2 and IMSDB.
Keep Reading