The STARTBR command establishes the position within the file, but does not retrieve a record.
Below is the syntax for STARTBR command.
EXEC CICS STARTBR FILE('file-name') RIDFLD(data-area) [GENERIC] KEYLENGTH(data-value) REQID(data-value) SYSID(system-name) GTEQ/EQUAL END-EXEC.
UPDATE option is not allowed and file browsing command is strictly for read-only operation.
Meaning of the parameters is same as READ operation explanation. When you want to do multiple browsing concurrently over the same file, then use REQID. The first STARTBR can be coded with REQID(1) and the second STARTBR can be coded with REQID(2).
One browse operation occupies one string of VSAM. If all VSAM strings are exhausted for one VSAM file, then the other transactions will have to wait for one of the strings to become free. So it is not recommended to use multiple browsing. Instead, once the browsing is completed, using RESETBR set the position to another place and start browsing. The syntax of RESETBR is same as STARTBR.
Let us see the parameters used in the STARTBR command.
Specifies the name of the file to be accessed.
Specifies the record identification field.
It has the name of the data area containing the key of the record which we want to read.
Specifies the length (halfword binary) of the key that has been specified in the RIDFLD option, except when RBA or RRN is specified, in which case KEYLENGTH is not valid.
This option must be specified if GENERIC is specified, and it can be specified whenever a key is specified. If the length specified is different from the length defined for the data set and the operation is not generic, the INVREQ condition occurs.
Specifies that the search is satisfied only by a record having the same key (complete or generic) as that specified in the RIDFLD option.
This option is the default field for a direct ESDS browse.
Specifies as a halfword binary value a unique request identifier for a browse, used to control multiple browse operations on a file. If this option is not specified, a default value of zero is assumed.
Specifies the name of the system to which the request is directed.
Specifies that the search key is a generic key whose length is specified in the KEYLENGTH option. The search for a record is satisfied when a record is found that has the same starting characters (generic key) as those specified.
Specifies that, if the search for a record that has the same key (complete or generic) as that specified in the RIDFLD option is unsuccessful, the first record that has a greater key satisfies the search.
This option is the default for directly browsing through a KSDS or an RRDS. It is not valid for directly browsing an ESDS, although it is valid for browsing through an ESDS using a path.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!