Need a ONLINE MAINFREAME Course/Poject Case Study) / Corporate Training/ application support ????

Lets schedule the class. Write me @, for more information refer to :
Iam Willing to take up Freelancing projects on Cobol / MF. please mail me @


Saturday, June 19, 2010




Match Merge logic is extensively used in COBOL programs to compare the data in two sequential files effectively. Only pre-requisite to for using this logic is, all input files to be in Sorted Order


Problem : I have 2 Sequential files File1  and File2.

                 If Record exists in both the files then write data into FILEA             

                 If Record exists only in File1 and not in File2 then write data into FILEB

                 If Record exists only in File2 and not in File1 then write data into FILEC


Solution: The effective way of solving above problem is, by using Match Merge Logic. Only pre-requisite to for using this logic is, all input files to be in Sorted Order.  First step sort I/P file


Explanation of Logic : Below listed are I/P and Output files data for say RollNo


File1                  File2                         FILEA                     FILEB                              FILEC

10                      10                               10                                

20                      20                               20

30                      50                                                               30

50                      60                               50                                                                     60

70                      99                                                                70

90                                                                                          90                                    99


         Open FILE1 and 2 in input mode, FileA, B, C in output mode

1.    Read File1     (Reads the record 10 )

2.    Read File2     (Reads the record 10 )


3.    Compare the Key Record of both Files  (File1-Rno = File 2-Rno).

a.      10 = 10; means record exists in both files)

b.    Write the  record in   FILE A


c.      As we need to advance further, repeat Step1  thru Step3


4.    When system reads the records  30 and 50, Step3 will Fail. So evaluate Step4

a.      If File1-Rno < File 2-Rno   (30 < 50)

b.      Record   30, which is > 20 and <50, means Rollno 30 is not present in FILE 2

c.      i.e., Record 30 exists only in File1

d.      Write the record into FILE B

e.      Now Read only FILE 1, and repeat thru step 3


5.    When system reads the records  70 and 60 from file1 and 2 respectively,  Step3,4 will Fail. So evaluate Step5

a.      If File1-Rno >  File 2-Rno   (70 > 50)

b.      Record  60 of file2, which is > 50 and <70, means Roll no 60 is not present in FILE 1

c.      i.e., Record 60 exists only in File2

d.      Write the record into FILE C

e.      Now Read only FILE 2, and repeat thru step 3


6.    Repeat above steps until end of both the files.

      Close all files


Advantages :  Open/close both file only once.




1.    Where do we use TSQs 

                Data in TSQ is stored as VSAM files

a.    Pageup and Pagedown Logic

b.    For writing Log Details (as we cant use Displays in CICS)


2.    How do we access the TSQ using a Key field

a.    Using RIDFIELD


3.    What is Sync Point and why is called as 2 Phase Commit

a.    Sync point is issued to save the data till that LUW.

b.    This is called as 2 Phase commit as , first it saves the data pertaining to File, Db2 then CICS data.

4.    I would like to generate only Input field (along with A, F, L) and not Output files in my Symbolic Map, how to achieve this ?

a.    Use Mode = IN   , in BMS macro

5.    How do you position your cursor on Map.

a.    Code   IC, in Attribute field of BMS macro of respective field

b.    Move -1 to Length field of respective field

c.    Using SEND MAP    CURSOR ( 100 )

6.    How do you test Physical Map layout in CICS region.

a.    Use CECI send Map () Mapset()

7.    What’s the debugging tool used for CICS

a.    We use CEDF/Intertest/Expeditor.

8.    How do you test / check the Cobol flow thru CEDF

a.    Use the Option TRACE

9.    How do Read a Vsam file  from Bottom to Top

a.    Move HIGH-VALUES to WS-KEY  and read previous

10.                       How do you execute Even steps in a job. Eg . execute only step2 in below example

//job1    job   ACC, Class=a,




    1. We can use the utility IEBEDIT or Use COND parameter. To skip first step use COND=ONLY, (this will flush the step1)


Wednesday, April 28, 2010

DB2-IMS - Few Difference

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

(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)