Db2 file system

The Db2® file system supports sequential, indexed, and relative files. It provides enhanced interoperation with TXSeries® or CICS® TX, enabling batch COBOL programs to access CICS ESDS, KSDS, and RRDS files that are stored in Db2.

Note: Effective 9 August 2024, IBM withdraws from marketing IBM CICS TX Standard (5900-ALU) and IBM CICS TX Advanced (5737-K69).

The implementation of the Db2 file system ensures that each COBOL operation is committed to the database so that no transactional or other database semantics show through to the COBOL program.

The Db2 database management system (DBMS) provides backup, compression, encryption, and utility functions, and also provides Db2 users with a familiar maintenance and administration protocol.

The db2 command-line utility provides administrative functions for Db2 files. For example, you might use the db2 describe command to print details about a file called CICS.Transaction.log in the Db2 file system:


> db2 describe table CICS.\"Transaction.log\"

                        Data type                    Column
Column name             schema    Data type name     Length   Scale Nulls
----------------------- --------- ------------------ -------- ----- ----
RBA                     SYSIBM    CHARACTER                8      0 No
F1                      SYSIBM    CHARACTER               41      0 No
F2                      SYSIBM    VARCHAR                 29      0 No

For more information about the functions that are provided by the db2 utility, enter the command db2.

The Db2 file system is nonhierarchical.

Restrictions:
  • A given program can use Db2 files in only one database.
  • The Db2 file system is not safe for use with multiple threads.

Interoperation with TXSeries or CICS TX:

For interoperation with TXSeries or CICS TX, there are additional requirements for Db2 files:
  • The schema name for the Db2 table must be CICS. Specify the fully-qualified name in one of these items:
    • The ASSIGN TO literal, for example, ASSIGN TO 'CICS.MYFILE'
    • The environment variable value, for example, export ENVAR=CICS.MYFILE
    • The ASSIGN USING data-name value, for example, MOVE 'CICS.MYFILE' TO fileData

    The rest of the file-name after the schema must be uppercase.

  • Fixed-length files have the following maximum record lengths:
    • Indexed (KSDS): 4005 bytes
    • Relative (RRDS): 4001 bytes
    • Sequential (ESDS): 4001 bytes
  • Files that have record lengths that are larger than the maximum record lengths for fixed-length files must be defined as variable length.
  • The maximum record length is 32,767 bytes.
  • If a Db2 file is created by a COBOL program, the runtime option FILEMODE(SMALL) must be in effect.

Related concepts  
File organization and access mode

Related references  
  
Effect of CLOSE statement on file types (COBOL for Linux on x86 Language Reference)  

DB2® Database Administration Concepts and Configuration Reference (SQL limits)