The READNEXT command EXEC CICS READNEXT { DATASET(name) | FILE(name) } { INTO(data-area) | SET(pointer-ref)...
The READNEXT command
EXEC CICS
READNEXT { DATASET(name) | FILE(name) }
{ INTO(data-area) | SET(pointer-ref) }
[ LENGTH(data-area) ]
RIDFLD(data-area)
[ KEYLENGTH(data-value) ]
[ RBA | RRN ]
[ REQID(data-value) ]
[ SYSID(name) ]
END-EXEC
Options
DATASET or FILE Specifies a 1 to 8 character name for the dataset as specified using CEDA DEFINE FILE(name)
INTO The target data area
SET Specifies a pointer data item (or register) to hold the address of the data record
LENGTH Specifies in a half word PIC S9(4) COMP field. This is an input / output field. On input it specifies the length of the data area. On return CICS sets into this field the length of the data returned. Required if you are dealing with variable length records.
RIDFLD If RRN or RBA is specified refers to relative record number of a RRDS or RBA of a ESDS file. If neither is specified this field contains the key of the KSDS record. This field must be as big as the full key length. It is an input / output field. If you set it with a value CICS uses the value to fetch the right record, skipping any records in the process while moving from the current position (skip sequential processing). Note that for skip sequential processing the key you set for READNEXT must be higher than what was returned in the previous call. If you specified EQUAL in the start browse command and CICS cannot find the record, it returns NOTFND. If GTEQ was specified while starting the browse, CICS returns the first record with a higher key than what you specified. CICS always sets the field with the full key of the record just read.
KEYLENGTH Specifies in a half word field ( PIC S9(4) COMP) field the length of the generic key. It has meaning if the browse was started(STARTBR), or reset(RESETBR) with the GENERIC keyword. Valid only for a KSDS and therefore invalid if the RRN or RBA keywords are specified. Also needed if SYSID is specified.
RBA Full word PIC S9(8) COMP field which specifies the relative byte address of the record for a KSDS or ESDS file.
RRN Full word PIC S9(8) COMP field which specifies the relative record number of the record for a RRDS file.
REQID Specifies a binary half word or literal value that identifies the browse operation. Useful when more than one browse is started on same file. You can then explicitly direct further browse operations to a specific operation.
SYSID Specifies a 1 to 4 character connection name that represents a remote system.
Conditions:
The RESP field can have the following values:-
DISABLED file is disabled using CEMT SET
DSIDERR File is not defined to CICS. In later systems also indicated by FILENOTFOUND.
LENGERR The buffer provided is too small to hold the record.
DUPKEY Occurs when you READNEXT via an alternate index to indicate that at least one more record with the same key exists. Issue READNEXT calls repeatedly until you don’t get the DUPKEY condition to fetch all records with the same key.
ENDFILE End of file condition.
ILLOGIC A serious VSAM error occurred
INVREQ The browse operation was not started by a STARTBR command, the meaning of the RIDFLD (RBA, RRN, Key) was changed in between the browse operation, or the KEYLENGTH is incorrect.
IOERR An IOERR occurred
NOTAUTH The transactions definition specified resource Checking and the operator is not authorized to Access the data set.
NOTFND The specified record could not be located.
NOTOPEN the data set is not open
SYSIDERR The system identified by SYSID could not be found.
Notes
- You must issue STARTBR before issuing this command. Note that each STARTBR holds a VSAM string.
- You cannot update a file using a browse operation. (exception is if the file is under RLS).
- For browsing via an alternate index specify the PATH name in the data set option when you define the file using CEDA. Check for the DUPKEY condition if the file permits duplicate alternate keys. The order of records are not assured to be in prime key sequence.
- DUPKEY (if accessing via a PATH) or ENDFILE are the only conditions you should expect to handle in your program.
The READPREV command
EXEC CICS
READPREV { DATASET(name) | FILE(name) }
{ INTO(data-area) | SET(pointer-ref) }
[ LENGTH(data-area) ]
RIDFLD(data-area)
[ KEYLENGTH(data-value) ]
[ RBA | RRN ]
[ REQID(data-value) ]
[ SYSID(name) ]
END-EXEC
Options
DATASET or FILE Specifies a 1 to 8 character name for the data set as specified using CEDA DEFINE FILE(name)
INTO The target data area
SET Specifies a pointer data item (or register) to hold the address of the data record
LENGTH Specifies in a half word PIC S9(4) COMP field. This is an input / output field. On input it specifies the length of the data area. On return CICS sets into this field the length of the data returned. Required if you are dealing with variable length records.
RIDFLD If RRN or RBA is specified refers to relative record number of a RRDS or RBA of a ESDS file. If neither is specified this field contains the key of the KSDS record. This field must be as big as the full key length. CICS always sets the field with the full key of the record just read.
KEYLENGTH Specifies in a half word field ( PIC S9(8) COMP) field the length of the generic key. It has meaning if the browse was started, or reset with the GENERIC keyword. Valid only for a KSDS and therefore invalid if the RRN or RBA keywords are specified. If RIDFLD and KEYLENGTH is set by the application and the browse was started with the GENERIC option, CICS repositions the browse using the new generic key.
RBA Full word PIC S9(8) COMP field which specifies the relative byte address of the record for a KSDS or ESDS file.
RRN Full word PIC S9(8) COMP field which specifies the relative record number of the record for a RRDS file.
REQID Specifies a binary half word or literal value that identifies this browse operation. Useful when more than one browse is started on same file. You can then explicitly direct further browse operations to a specific operation.
SYSID Specifies a 1 to 4 character connection name that represents a remote system.
Conditions:
The RESP field can have the following values:-
DISABLED file is disabled using CEMT SET
DSIDERR File is not defined to CICS. In later systems also indicated by FILENOTFOUND.
LENGERR The buffer provided is too small to hold the record.
DUPKEY Occurs when you READPREV via an alternate index to indicate that at least one more record with the same key exists. To fetch all records with the same key, issue READPREV calls repeatedly until you don’t get the DUPKEY condition.
ENDFILE End of file condition.
ILLOGIC A serious VSAM error occurred
INVREQ A browse operation was not started by a STARTBR command, the meaning of the RIDFLD (RBA, RRN, key) was changed during the browse operation, or the KEYLENGTH is invalid.
IOERR An IOERR occurred
NOTAUTH The transactions definition specified resource Checking and the operator is not authorized to Access the data set.
NOTFND The specified record could not be located.
NOTOPEN the data set is not open
SYSIDERR The system identified by SYSID could not be found.
Notes:
- You must issue STARTBR before issuing this command. Note that each STARTBR holds a VSAM string.
- You cannot update a file using a browse operation.
- For browsing via an alternate index specify the PATH name in the data set option when you define the file using CEDA. Note that DUPKEY conditions are possible when browsing via an alternate index.
- DUPKEY (if accessing via a PATH) or ENDFILE are the only conditions you should expect to handle in your program.
- If you issue READPREV immediately after READNEXT the same record is fetched again.
- At STARTBR position at the end of the file (by moving high values into the RIDFLD) before issuing this command if you want to read this file backwards.
No comments
Post a Comment