Cobol-DB2 | Cobol -IMS | |
1 | Need to Prcompile to generate 1. DBRM (Sql Staments only) 2. Cobol Object code | No Precompilation Required |
2 | Bind the DBRM to Generate Plan. Plan consists of Executable SQL Quries | No Bind Process is Required. Here we Write PSBs to fetch respective Record. |
3 | Compile Cobol Code | Compile Cobol-Ims program |
4 | Execute Cobol - DB2 Program using IKJEFT01, where in we Specify Program Name and Plan Name to be Executed | Execute Cobol-IMS program using DFSRRC00. Pass Program Name , PSB, Name, Plan name Thru Parm Parameter |
Why We need BIND In DB2 not in IMS | ||
Say below query is written in Cobol-Db2 Program | Equivalent IMS Call | |
1 | Select A, B, C | First Define PCB to Fetch the field A, B, C |
Where A=10 | Using DLI Call fetch the field A, B, C specified in above PCB | |
CALL CBLTDLI USING GU , PCB-NAME , SSA-Field (Populate Key value 10 to SSA) | ||
2 | Above Query turned to executable query by binding Plan | compile PSB (can hold n no of PCBS) |
3 | use this plan to execute the Program (while executing Cobol- Db2 Program, when a DB2 statement is encountered, system refers to plan to execute respective query) | Using This PSBLIB to execute the CBLTDLI call. (while executing Cobol-IMS Program, when a DLI /IMS statement is encountered, system points to respective segment to be fetched using respective PCB) |
In DB2, the columns defined as NULL needs to be handled carefully else it will throw null exception error, in order to over come this error data type can be handled by using null indicator . NULL is stored using a special one-byte null indicator that is "attached" to every nullable column. If the column is set to NULL, then the indicator field is used to record this. Using NULL will never save space in a DB2 database design - in fact, it will always add an extra byte for every column that can be NULL. The byte is used whether or not the column is actually set to NULL. The indicator variable is transparent to an end user Consider below Table : Create Table SAMP_TAB SN CHAR (10) SNAME CHAR (10) STATUS CHAR (2) NOT NULL BY DEFAULT CITY CHAR (10) NOT NULL Note :: Unless you specify NOT NULL, the default is to allow for NULL In above table SN and SNAME columns holds null values by default, in order to handle these null variables we need to have NULL-INDICATORS declares in the Pro
Comments