IBM Support

EXEC CICS READNEXT for a remote KSDS file returns the same record

Troubleshooting


Problem

You are reading a file using EXEC CICS READNEXT after a STARTBR. You notice a READNEXT for a remote file using MRO gives the same record (duplicate record) back each time. If the file is local, the READNEXT returns the next record in the dataset as expected. You are using an alternate index (AIX).

Symptom

In this case, the file being read is a PATH for a VSAM KSDS file. The KEYLENGTH of the Base cluster is 36 bytes and the KEYLENGTH of the alternate index (AIX) is 86 bytes. If CECI STARTBR with KEYLENGTH of 86 is used from the remote region, there is a normal response. A READNEXT returns the first record in the file as expected. All subsequent READNEXTs get the same record. If the key is intentionally changed, a different record is returned.

Cause

For remote files, the KEYLENGTH can be specified in the CICS FILE definition. In this case, the KEYLENGTH for the Base cluster was used when defining the Path of the dataset.

The AIX allows you alternate access into the Base cluster using a different (or alternate) key. Therefore, the file definition in CICS for the path should contain the key length of the alternate key.

Diagnosing The Problem

The RIDFLD is used as an output parameter on the READNEXT command. On completion of each READNEXT command, CICS places the complete identifier of the record just retrieved into the RIDFLD data area. CICS then holds this identifier to mark the point from which the subsequent READNEXT is to continue. If you access a file through a path, the RIDFLD parameter on the READNEXT should contain a valid key for that path and not a base key. The KEYLENGTH specifies the length of the key that has been specified in the RIDFLD option.

Resolving The Problem

Specify the KEYLENGTH for the AIX in the CICS FILE definition for the Path. Alternately, remove the KEYLENGTH from the FILE definition and specify it on file control commands in the application programs that refer to the file.

If KEYLENGTH is not defined on the FILE definition and not specified in the application program, and the key is longer than 4 characters, the default value is 4.

[{"Type":"MASTER","Line of Business":{"code":"LOB35","label":"Mainframe SW"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGMGV","label":"CICS Transaction Server"},"ARM Category":[{"code":"a8m0z000000cwgsAAA","label":"Data services and Data tables-\u003EVSAM files"}],"ARM Case Number":"","Platform":[{"code":"PF035","label":"z\/OS"},{"code":"PF038","label":"z\/VSE"}],"Version":"All Versions"}]

Product Synonym

CICS/VSE CICS VSE CICS/TS CICS TS CICS Transaction Server

Document Information

Modified date:
26 March 2024

UID

swg21026349