পৃষ্ঠাসমূহ

Search Your Article

CS

Pageviews

Showing posts with label COBOL Tutorial. Show all posts
Showing posts with label COBOL Tutorial. Show all posts

Friday, January 27, 2017

COBOL - Overview

COBOL is a high-level language. One must understand the way COBOL works. Computers only understand machine code, a binary stream of 0s and 1s. COBOL code must be converted into machine code using a compiler.

COBOL - Environment Setup

Try it Option Online

We have set up the COBOL Programming environment online, so that you can compile and execute all the available examples online. It gives you confidence in what you are reading and enables you to verify the programs with different options. Feel free to modify any example and execute it online.

COBOL - Program Structure

A COBOL program structure consists of divisions as shown in the following image:
Program Structure A brief introduction of these divisions is given below:

COBOL - Basic Syntax

Character Set

'Characters' are lowest in the hierarchy and they cannot be divided further. The COBOL Character Set includes 78 characters which are shown below:

COBOL - Data Types

Data Division is used to define the variables used in a program. To describe data in COBOL, one must understand the following terms:
  • Data Name
  • Level Number
  • Picture Clause
  • Value Clause

COBOL - Basic Verbs

COBOL verbs are used in the procedure division for data processing. A statement always start with a COBOL verb. There are several COBOL verbs with different types of actions.

COBOL - Data Layout

COBOL layout is the description of use of each field and the values present in it. Following are the data description entries used in COBOL:
  • Redefines Clause
  • Renames Clause
  • Usage Clause
  • Copybooks

COBOL - Condition Statements

Conditional statements are used to change the execution flow depending on certain conditions specified by the programmer. Conditional statements will always evaluate to true or false. Conditions are used in IF, Evaluate and Perform statements. The different types of conditions are as follows:

COBOL - Loop Statements

There are some tasks that need to be done over and over again like reading each record of a file till its end. The loop statements used in COBOL are:
  • Perform Thru
  • Perform Until
  • Perform Times
  • Perform Varying

COBOL - String Handling

String handling statements in COBOL are used to do multiple functional operations on strings. Following are the string handling statements:
  • Inspect
  • String
  • Unstring

COBOL - Table Processing

Arrays in COBOL are known as tables. An array is a linear data structure and is collection of individual data items of same type. Data items of a table are internally sorted.

COBOL - File Handling

The concept of files in COBOL is different from that in C/C++. While learning the basics of 'File' in COBOL, the concepts of both languages should not be co-related. Simple text files cannot be used in COBOL, instead PS (Physical Sequential) and VSAM files are used. PS files will be discussed in this module.

COBOL - File Organization

File organization indicates how the records are organized in a file. There are different types of organizations for files so as to increase their efficiency of accessing the records. Following are the types of file organization schemes:

COBOL - File Access Mode

Till now, file organization schemes have been discussed. For each file organization scheme, different access modes can be used. Following are the types of file access modes:
  • Sequential Access
  • Random Access
  • Dynamic Access

COBOL - File Handling Verbs

File handling verbs are used to perform various operations on files. Following are the file handling verbs:
  • Open
  • Read
  • Write
  • Rewrite
  • Delete
  • Start
  • Close

COBOL - Subroutines

Cobol subroutine is a program that can be compiled independently but cannot be executed independently. There are two types of subroutines: internal subroutines like Perform statements and external subroutines like CALL verb.

COBOL - Internal Sort

Sorting of data in a file or merging of two or more files is a common necessity in almost all business-oriented applications. Sorting is used for arranging records either in ascending or descending order, so that sequential processing can be performed. There are two techniques which are used for sorting files in COBOL:

COBOL - Database Interface

As of now, we have learnt the use of files in COBOL. Now, we will discuss how a COBOL program interacts with DB2. It involves the following terms:
  • Embedded SQL
  • DB2 Application Programming
  • Host Variables
  • SQLCA
  • SQL Queries
  • Cursors

COBOL Interview Questions

Dear readers, these COBOL Interview Questions have been designed especially to get you acquainted with the nature of questions you may encounter during your interview for the subject of COBOL Programming Language. As per my experience, good interviewers hardly plan to ask any particular question during your interview.

COBOL Questions and Answers

COBOL Questions and Answers has been designed with a special intention of helping students and professionals preparing for various Certification Exams and Job Interviews. This section provides a useful collection of sample Interview Questions and Multiple Choice Questions (MCQs) and their answers with appropriate explanations.