CICS - READNEXT / READPREV



When we issue a STARTBR command, it does not make the records available. It just tells from where to start reading the file. To get the first record and sequence after that, we need to use the READNEXT command.

  • The FILE, INTO, and LENGTH parameters are defined in the same way as they are in the READ command. We only need the FILE parameter because CICS allows us to browse several files at once and this tells which one we want to read next.

  • RIDFLD points to a data area into which the CICS will "feed back" the key of the record it just read.

  • The READPREV command is almost like READNEXT, except that it lets us proceed backward through a data set instead of forward.

Syntax

Following is the syntax of READNEXT / READPREV command −

EXEC CICS READNEXT/READPREV
   FILE ('name')
   INTO (data-value)
   LENGTH (data-value)
   RIDFLD (data-value)
END-EXEC
cics_file_handling.htm
Advertisements