Module 6: CICS File Handling
ENDBR
The ENDBR command ends a browse operation. It tells CICS you are done reading the file sequentially, and CICS releases the VSAM resources the browse was holding. Every browse started with STARTBR should be closed with ENDBR as soon as it is finished.
Syntax of the ENDBR command
- FILE - the file name from the File Control Table. It is the only option on the command.
- ENDBR terminates the browse and releases the VSAM resources allocated to it.
- Code ENDBR as soon as you are done browsing - do not leave the browse open while the program does unrelated work.
- A typical ENDBR command:-
EXEC CICS ENDBR FILE('INVOICE') RESP(RESPONSE-CODE) END-EXEC. IF RESPONSE-CODE NOT = DFHRESP(NORMAL) PERFORM 9999-TERMINATE-PROGRAM END-IF.
Repositioning a browse with RESETBR
- The RESETBR command restarts an active browse at a new position without ending it first. It takes the same options as STARTBR: FILE, RIDFLD, RRN, RBA, GTEQ, EQUAL, GENERIC and KEYLENGTH.
- Use RESETBR when the program needs to jump to a different key in the middle of a browse, for example when the user types a new starting customer number.
- If no record matches the GTEQ/EQUAL condition, the NOTFND condition is raised, just like with STARTBR.
- Example:-
EXEC CICS RESETBR FILE('CUSTMAS') RIDFLD(CM-CUSTOMER-NUMBER) EQUAL RESP(RESPONSE-CODE) END-EXEC. IF RESPONSE-CODE = DFHRESP(NOTFND) MOVE 'Customer not found.' TO MESSAGEO ELSE IF RESPONSE-CODE NOT = DFHRESP(NORMAL) PERFORM 9999-TERMINATE-PROGRAM END-IF.
