11
IBM-Mainframes COBOL Class-1

COBOL_Training_Class-1.ppsx

Embed Size (px)

Citation preview

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 1/11

● IBM-Mainframes

COBOL Class-1

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 2/11

Background and History

COBOL is an acronym for:

 – Common Business Oriented Language

COBOL was developed in 1959 by the Conference on Data

 Systems Languages (CODASYL). COBOL was designed to solve business problems

COBOL was designed to be English-like, so that the reader, even

a nonprogrammer, could get an idea of what was going on in the

 program, simply by reading the code!

COBOL was designed to be portable, so that programs could be

adapted from one computer system to run on another, simply by

ma"ing a few changes in one isolated section of the code!

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 3/11

Background and HistoryContd..

#ince 19$%, the &merican 'ational #tandards (nstitute

)&'#(* was responsible for developing new COBOL

standards!

+hree &'#( standards for COBOL have been

 produced:

in 19$, 19-. and 1985 (currently Using ).

Ob/ectoriented COBOL is the fourth edition in the

continuing evolution of &'#(0(#O standard COBOL!

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 4/11

Structure of COBOL Program

+he organiation of a COBOL program is hierarchical! (t2s notnecessarily re3uired for all of components to be present for the

hierarchical relationship to e4ist

.. Program

.. ivision

.. !ection

.. Paragraph

.. !entence

.. !tatement

.. "lause # Phrase

.. $or% (.. "haracter)

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 5/11

COBOL Program Organization!i"ision#

e have four divisions in every COBOL program&E'&&"*&+', E'&+'/E',**, an% P+"EUE.

 (67'+(8(C&+(O' 6((#(O' +he first division of COBOL program

used for documentation purposes!

 P+0*/-& is used to name the program! +his is the only

 paragraph that is re3uired in the (6 6((#(O'!

*U+  used to code the programmer2s name

&'!*22*&+' used to code the programmer2s employer2s name  *E-$&E' ; *E-"+/P&2E used to code the date the

 program was written ; compiled

!E"U&3  used to code the security level of the program

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 6/11

!i"ision$sContd..

7'(<O'=7'+ 6((#(O'  >rovides information on the e3uipment

and file used with the program and only division that may be machine

dependent!

4o sections: CO'8(?@<&+(O' and ('>@+O@+>@+ #ection

"+'&0U*&+' !E"&+'  optional section is used to specify the

type of computer e3uipment

!+U"E-"+/PUE  used to compile the program!

+6E"-"+/PUE  used to e4ecute the program!

&'PU-+UPU !E"&+' used to specify input0output files used in

the program!

 &2E-"+'+2 used to associate the files to be used in the

 program with specific (0O devices!

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 7/11

!i"ision$sContd..

** &&!&+' : 6efines and describes all the data to be used in a program0+o declare variables!

#ections: &2E, $+7&'0-!+*0E, 2&'7*0E, <7>O<+, and

CO==@'(C&+(O' #7C+(O'#

 &2E !E"&+' is used to define the files record layout that will be usedin the program!

$+7&'0-!+*0E  is used to define any data that will be used in

the program that is not part of a file section!

2&'7*0E !E"&+' is used in a subprogram to define data that will be

 passed as arguments to the routine!

EP+ !E"&+' can be used to produce standard control brea" driven

reports! "+//U'&"*&+' !E"&+' is used for communicating

 between two programs running simultaneously on a computer 

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 8/11

!i"ision$sContd..

><OC76@<7 6((#(O' +his contains the instruction to be

e4ecuted in the program

+his division consists of a series of procedures called

 paragraphs, each designed to perform a specific function! >aragraph  Consists of a paragraph name coded in area a and a

series of procedural statements designed to perform a desired

function coded in area b!

!tatement : &n instruction!

!entence : & statement or series of statement ending with a

 period )!*

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 9/11

COBOL Layout%COBOL Code S&eet 1 -'(#

1. 1- !euence 'umber +his area was originally designed forentering line numbers on each individual line of code!

:. ; "omments #"ontinuation  +his area is used designate a line

as either a comment or a continuation!

< +his line is a comment! - +his line is a continuation of the previous line!

=. 8-11 *rea * +his area is used to enter division headers, section

headers, paragraph names, file indicators and level %1 items!

>. 1:-;: *rea  +his area is used to enter any statement that

doesn2t go in &rea &!

5. ;=-8? Program &%enti@ication +his area has been used by

 programmers as a way to mar" individual lines of code,

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 10/11

My )irst COBOL Program

Aello world >rogram

&E'&&"*&+' &&!&+'. ( & &&!&+' )

P+0*/-&. E22+P0/. -  /aA 8 character 

E'&+'/E' &&!&+'.** &&!&+'.

P+"UE &&!&+'.

&!P2*3-P**.

&!P2*3 BE22+ $+2CD.!+P U'.

+his >rogram gives E22+ $+2C &s Output!

7/27/2019 COBOL_Training_Class-1.ppsx

http://slidepdf.com/reader/full/coboltrainingclass-1ppsx 11/11

*&ank +ou

Any Quires