DB2 - Precompilation Process




DB2 Precompilation Process

A relational database is a DBMS that represents the data in a tabular form of rows and columns. A table is a representation of an entity. A table is a combination of columns and rows. Each column in a table represents an attribute of the entity, also known as fields or properties. Each row in a table represents a record, the data associated with an entity.

A relational database management system (RDBMS or just RDB) is a common type of database whose data is stored in tables. You’ll find that most databases used in businesses these days are relational databases, as opposed to a flat file or hierarchical database. Relational databases have the clout to handle multitudes of data and complex queries, whereas a flat file takes up more space and memory, and is less efficient. So modern databases use multiple tables as standard. The data is stored in lots and lots of tables, or ‘relations’. These tables are divided into rows (records) and columns (fields).

Benefits of Relational Databases

If you want to design a data storage system that makes it easy to manage lots of information, and is scalable and flexible, the relational database is a good bet.

Manageability − for starters, an RDB is easy to manipulate. Each table of data can be updated without disrupting the others. you can also share certain sets of data with one group, but limit their access to others, such as confidential information about employees.

Flexibility − if you need to update your data, you only have to do it once – so no more having to change multiple files one at a time. And it’s pretty simple to extend your database. If your records are growing, a relational database is easily scalable to grow with your data.

Avoid Errors − there’s no room for mistakes in a relational database because it’s easy to check for mistakes against the data in other parts of the records. And since each piece of information is stored at a single point, you don’t have the problem of old versions of data clouding the picture.

What is DB2 Precompilation Process ?

Pre-compiler is mainly responsible for to divide the COBOL, DB2 statements separately. it takes COBOL+DB2 source code as input and separates the COBOL & DB2 statements. pre compiler is responsible to check the syntax errors of DB2 statements before putting in DBRM. Pre compiler doesn’t check the syntax errors in COBOL statements. Pre compiler used to generate time stamp tokens.

DBRM − DBRM is data base request module where syntax free SQL statements are stored. DBRM library is a user defined PDS and syntax free SQL statements will be stored with the program name.

PLAN − DSNHPC utility will uses for the pre-compilation process. DBRM is also PDS where all the SQLs will be stored after it got separated from COBOL program. RUNTIME SUPERVISOR mainly responsible for to check the what are the time stamps for COBOL & DB2

BIND − BIND is the process to create the optimized access path to retrieve the data from the DB2 for the SQLs coded in the program. BIND takes DBRM as input and generates the optimized access path with the help of optimizer which checks the table statistics.

DB2 applications require different methods of program preparation, depending on the type of the application.

Applications that contain embedded static or dynamic SQL statements.

DB2 applications embed SQL statements in traditional language programs. To use these programs, you must follow the typical preparation steps as well as the DB2 precompile and bind steps. Some languages can be precompiled and compiled in a single step by a coprocessor.

Applications in interpreted languages, such as REXX and APL2, REXX procedures use dynamic SQL. You do not precompile, compile, link-edit, or bind DB2 REXX procedures before you run them.

Applications that contain ODBC calls, These applications pass dynamic SQL statements as arguments. You do not precompile or bind ODBC applications. ODBC applications use a standard set of functions to execute SQL statements and related services at run time.

Java applications, which can contain JDBC calls or embedded SQL statements, Preparing a Java program that contains only JDBC methods is the same as preparing any other Java program. You can prepare the program using the javac command. JDBC applications do not require the precompile or bind steps.

You can use IBM pureQuery can create and prepare Java applications. IBM pureQuery enables SQL access to databases or Java objects that are in memory and facilitates SQL best practices. Preparing an SQLJ program requires a precompile step and a bind step. The following program preparations steps are required by traditional programming languages.