READNEXT and READPREV request processing
READNEXT and READPREV request processing are very similar, and are described together.
VSAM processing:
- A check is made that READPREV with a generic key was not requested. If it was, condition INVREQ is raised.
- If KEYLENGTH was specified, it is checked for validity. If it is incorrect, the INVREQ condition is raised.
- The RPL options are set.
- If SET is specified, an internal work area is obtained and the RPL is set to point to the work area. The area is either above or below the 16MB line, depending on the requirements of the application.
- If INTO is specified, the RPL is set to point to the user-specified area.
- A VSAM request is issued to read the record. Shared control of the CI is needed, and the request will not succeed if some other task already has exclusive control. In such a case, a call is made to VSAM to reestablish the correct position in the file. The task then waits until VSAM informs CICS that the CI is available to the task. CICS resumes the task, which can now acquire shared control and obtain the required record.
- If SET is specified, the SET pointer points to the work area.
- If INTO is specified, a check is made to see if the record is too large to fit into the user-specified area. If it is too large, the request is reissued using an internal work area, the data is copied from the work area into the user-specified area and truncated, and the LENGERR condition is raised.
- If required, the request is recorded in a user-specified journal.
- A check is made that READPREV was not issued. If it was, condition INVREQ is raised.
- The FIOA that was created on STARTBR is located.
- If a new block is required, a BDAM I/O request is issued to get it.
- If deblocking is required, the required record is located in the block
that has been returned by BDAM:
- If DEBREC has been specified, the record number is used to locate the record.
- If DEBKEY has been specified, the embedded key is used to locate the record.
- If INTO is specified, the record or block is moved from the FIOA to the user-specified area. If the record is longer than the user-specified area, it is truncated, and the LENGERR condition is raised.
- If SET is specified, the SET pointer points to the record in the FIOA.
- The RIDFLD of the record is returned to the application.
- The current browse position is recorded in the FIOA.