I am trying to read a VSAM KSDS file sequentially using STARTBR and READNEXT. I am able to read the 1st record. After processing 1st record, I was expecting the read of 2nd record from the VSAM when READNEXT is executed but only first record is read again. Could you please help here? I am using same lines 2 times: 1 after STARTBR and 1 while reading the next record after 1st.
MOVE LENGTH OF WS-INPUT-DATA TO X01-KEY1-LENGTH
EXEC CICS READNEXT DATASET(X01-INPUT-NAME)
INTO(WS-INPUT-DATA)
RIDFLD(X01-KEY1)
LENGTH(X01-KEY1-LENGTH)
RESP(X-RESP)
END-EXEC
From the description it looks like the RIDFLD has changed between the 1st and 2nd requests, possibly cleared, that will cause the browse to be repositioned to look for the next record after the new value passed in RIDFLD.
Make sure that on the 2nd READNEXT that the RIDFLD has the value returned by the 1st READNEXT.