In this topic, we described about the File Handling with detailed example.
CICS data management services have traditionally been known as CICS file control. CICS file control provides access to data sets that are managed by either the Virtual Storage Access Method (VSAM) or the basic direct-access method (BDAM).
CICS file control provides services to read, update, add and browse data in VSAM and BDAM data sets and delete data from VSAM data sets. CICS shared data tables and coupling facility data tables can be accessed by using file control.
CICS application program reads and writes data in the form of individual records. Each read or write request is made as a CICS command from the application program.
CICS supports only VSAM and BDAM files. All the files used in CICS application, should be registered in FCT with the complete attributes. CICS commands use the FCT entries to get the file DSN and for performing the operations on the file.
The files that are not declared in FCT table will not be recognized by the CICS. In CICS, the entries in FILE SECTION or DATA DIVISION entries are not required because the file is declared in FCT and the data about the file is available to all.
File operations like read, update, add, browse and delete can be controlled by the file attributes defined in FCT. User can override the file attributes in FCT by using CEMT. CICS Supports sequential/Random reading of Key sequential datasets.
Below are the file handling commands -
|WRITE||Write a record to the file.|
|REWRITE||Update a record in a file.|
|DELETE||Delete a record from a file - VSAM KSDS, VSAM RRDS and data tables only.|
|READ||Read a record from a file.|
|STARTBR||Start browsing of a file.|
|READNEXT||Read next record during a file browse.|
|READPREV||Read previous record during a file browse; VSAM and data tables only.|
|RESETBR||Reset the start of a file browse.|
|UNLOCK||Releases the exclusive control on file.|
|ENDBR||End the file browse.|