5 Best COBOL Questions and Solutions

I have presented here the most frequently asked questions in COBOL. This is a quick refresher and you can read it in very less time. (You can read this good book for super success in office How to win in office politics). Many of my friends asked write some questions. So I have given list for you.

  1. Entry, and USING – these two phrases are COBOL words, you use these to connect external interface.  For example, you can use these in IMS DB and COBOL programs . Similarly, in sub-program, you use USING to connect to called program. In IMS DB you can use this way – in PROCEDURE DIVISION, ENTRY ‘ CBLTDLI’ USING TP-PCB.
  2. The next best question is INITIAL – this parameter makes COBOL program initial state every time when it is called by any other program. This you can use it in COBOL, CICS and IMS DC programs.
  3. Another question is SEARCH and SEARCH ALL – these two types you can use for searching an internal array. In SEARCH ALL the table must be in indexed and with a key either ascending or descending mode. However, you can also use PERFORM  Varying for searching a table. The PERFORM Varying you can also use to do a search in multi-dimensional tables. SEARCH you can use it in single dimension table. In SEARCH ALL you cannot give more than one WHEN condition and  ‘OR’ is not allowed, but ‘AND’ is allowed in SEARCH condition
  4. Usage of HIGH-VALUES – whenever you want to compare data in 2 files, the there is a possibility that one file can be achieved AT END condition before the second file. So, instead to CLOSE the file you can use MOVE HIGH-VALUES TO KEY-FILED. So that this logic allows you to continue reading the file
  5. Last question is on SORT and MERGE –  these will be used in Banking/Insurance/Finance projects. The same you can be achieved with JCL sort. The real advantage of using COBOL sort is – it is like simple SORT, and you cannot give complex SORT conditions in COBOL. The next disadvantage of using SORT in COBOL is wriring sort in COBOL is laborious and lengthy.

More: Advanced COBOL tips You can read


Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.