Popular

COBOL coding rules

  • Each line is considered to be made up of 80 columns.
  • Columns 1 to 6 are reserved for line numbers.
  • Column 7 is an indicator column and has special meaning to the compiler.
Asterisk ( * ) indicates comments
Hyphen ( -) indicates continuation
Slash ( / ) indicates form feed
  • Columns 8 to 11 are called Area A. All COBOL DIVISIONs, SECTIONs, paragraphs and some special entries must begin in Area A.
  • Columns 12 to 72 are called Area B. All COBOL statements must begin in Area B.
  • Columns 73 to 80 are identification area

INITIALIZE Verb IN COBOL : What does the INITIALIZE Verb do?

Alphabetic, Alpha-numeric fields and alpha-numeric edited items are initialized to SPACES.

Numeric and Numeric-edited items are set to ZEROES. FILLER and OCCURS Clause items are left untouched.

What are the different data-types in COBOL?

Alpha-numeric (X), alphabetic (A) and numeric (9).

Basic data types

􀂃Alphabetic ( A)
􀂃Numeric( 9)
􀂃Alphanumeric (X)
􀂃Edited numeric ( Z, $)
􀂃Edited alphanumeric(/,-)

Name the divisions in a COBOL Program.

The four divisions in a COBOL Program are IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION and PROCEDURE DIVISION.


Tell us briefly about each division.
IDENTIFICATION DIVISION
is used to establish the Identity of the program, and assigns a unique name to the Program.

ENVIRONMENT DIVISION tells the environment – SOURCE-COMPUTER and OBJECT-COMPUTER on which the COBOL Program would run. It also declares the Input and Output file-names, accessed by the COBOL Program.

DATA DIVISION is the place in the COBOL Program, that creates Storage areas(COBOL Variables) for storing Data. Generally, COBOL Programs read data-records from Input-File, or Write records to Output-file. When the data-record from the Input-file is read, there's got to be a place in the COBOL Program, where the Input File Data arrives, its received and it has to be stored. COBOL Programs may do some rough-work. Such variables which act like a temporary scratch-pad, where you could do some rough-work, and which are there only as long as the COBOL Program runs are called WORKING-STORAGE Areas.

PROCEDURE DIVISION is the starting-point of the COBOL Program, where the Program begins to run. You code the Instructions that you to perform one-by-one in the PROCEDURE DIVISION.

COBOL CHARACTER SET

COBOL CHARACTER SETMeaning
Space
+ Plus sign
- Minus sign or hyphen
* Asterisk
/ Forward slash or solidus
= Equal sign
$ Currency sign1
, Comma
; Semicolon
. Decimal point or period
" Quotation mark2
( Left parenthesis
) Right parenthesis
> Greater than
< Less than
: Colon
' Apostrophe
A-Z Alphabet (uppercase)
a-z Alphabet (lowercase)
0-9 Numeric characters

COBOL –Program StructurePrincipal

What does COBOL stand for?

COmmon Business Oriented Language.

Which are target area of COBOL applications?
Defense, Aircraft, Insurance, Finance, Retail etc (file & data oriented applications involved)

So we can say that COBOL is basically used for writing business applications

History of COBOL

1959 –United States Department of Defense
1960 -COBOL initial specifications presented by CODASYL (Conference on
Data Systems Languages)
1964 –BASIC COBOL extended to Visual COBOL
1968 –ANSI (American National Standards Institute) developed
American National Standard (ANS) COBOL
1974 –ANSI published revised version of (ANS) COBOL
–Business applications needed to manipulate character as well as numeric data
–String operations added
1985 –COBOL 85 Standards was introduced with revised version of COBOL-74.