How to Browse VSAM File in CICS

In CICS, you can access data from either files or DB2. Once you define the files to CICS, the CICS command codes that you will give in COBOL help you fetch Records.

I found some interview questions here. How to browse a record from a file that can be either KSDS/ESDS/RRDS. If you are able to answer this kind of questions then your chances are more to select. A project like HSBC/General Motors/Allstate etc they use a lot of CICS programs.

CICS does not support LDS files

START Browse EXEC CICS Macro

XX00-START-CUSTOMER-BROWSE.
*
     EXEC CICS
         STARTBR FILE('SRINIMF')
                 RIDFLD(CM-CUSTOMER-NUMBER)
                 EQUAL                     
                 RESP(RESPONSE-CODE)
     END-EXEC.
     EVALUATE RESPONSE-CODE
         WHEN DFHRESP(NORMAL)
             MOVE 'Y' TO CUSTOMER-FOUND-SW
         WHEN DFHRESP(NOTFND)
             MOVE 'N' TO CUSTOMER-FOUND-SW
         WHEN OTHER
             PERFORM 9999-TERMINATE-PROGRAM
     END-EVALUATE.

The above example says that how to handle the files. Once it matches the key value, it sends the proper value to the program variable. Else, it terminates the program.


SrinimfArts

SALE Now: Paper Art

This art wiil be delivered in digital form across the world. We sell this item only one item. No duplicate items will be sold. This is our assurance by SrinimfArts.

$50.00


Start Browse Advanced Options

EXEC CICS
    STARTBR  FILE(filename)
             RIDFLD(data-name)
            [RRN | RBA]
            [GTEQ | EQUAL]
            [GENERIC]
            [KEYLENGTH(data-name | literal)]
END-EXEC

In the above example, I have explained how to use KSDS/ESDS file and with advances options.

After the STARTBR, the other options are READNEXT and READPREV. So each command maximum length is ‘8’ bytes and not more than that.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.