In CICS, you can retrieve data either from files or DB2. Files are two types – VSAM and BDAM. Once you define the files to CICS, the next task is retrieve records. This you can do by using CICS commands in application program(For instance, COBOL/PLI programs).
I gathered possible interview question on this topic. How to browse a record from a file of KSDS/ESDS/RRDS or BDAM?.
BDAM files those store in Direct access storage. On the contrary, VSAM files reside in Virtual storage. The top CICS users are HSBC/General Motors/Allstate. Here’s a quick note that CICS does not support LDS files.
The RIDFLD tells that you are accessing BDAM files. The STARTBR command establishes a record based on RIDFLD. Here is my other post on how to browse VSAM files in CICS.
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.
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