Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
10Activity
0 of .
Results for:
No results containing your search query
P. 1
10 - Program Flow Control

10 - Program Flow Control

Ratings: (0)|Views: 158 |Likes:
Published by Quasar Chunawalla
An excerpt tutorial from my knowledge portal - http://www.mainframes360.com
An excerpt tutorial from my knowledge portal - http://www.mainframes360.com

More info:

Published by: Quasar Chunawalla on Jan 06, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

07/30/2014

pdf

text

original

 
Wednesday, 06 January 2010© Mainframes360.com – QuasaVisit us at :http://www.mainfra 
Program Flow
.
 
What does one mean
COBOL allows programmercan divide and organizeor paragraph is dedicata particular section ortowards the task you warogram.hen the control firstbe performed, you accorappropriate section orProgram Flow Control.You have written the prarticular task/functiothat section or paragrasearch the whole progra
.
 
How do you write SEC
Just as DIVISION’s starnames should begin inwith a period.oreover, it is customaGenerally, the naming cdifferent shops) is toyour program has 2 para0200-CHINA. This way, iGiven below is simple etwo sections READ-FILE-one paragraph.Example:Think what if, you execrogram is the PROCEDUone-by-one sequentially
r Chunawalames360.com 
Control 
y
 
‘Program Flow Control’? Why is it
s to write computer programs in a syour programs into sections and pared to perform a specific task or fuparagraph, you can focus and put ant to perform, without bothering abenters into the Program, dependingdingly just direct/transfer the contparagraph, jump to the relevant parogram, in a well-organised manner. Inality, you only need to search andph corresponding to this functionalm).
TION’s and PARAGRAPH’s in COBOL?
 
t in Area A(Columns 8-11), Sectionrea A. Every Section name and paragrry to follow a naming-convention foronvention for COBOL Para’s used byprefix the paragraph name with a nugraphs INDIA and CHINA, then name tt becomes easier to identify them.xample of a typical COBOL Program tSECTION and WRITE-FILE-SECTION, eacuted this COBOL Program. The startiE DIVISION. Each statement is execut. It is terminated at STOP RUN. Thus
important?
 
s
 
tematic manner. Youagraphs. Each sectionction. While writingl your energy,ut the rest of thepon what task is torol to the. This idea is calledf an error occurs inrectify the error inty(You don’t need toames and Paragraphaph name should endparagraph-names.ost programmers(inber. For example, ifem as 0100-INDIA andat is divided intoof them containingg point of theed by the computer, the output on the
 
Wednesday, 06 January 2010© Mainframes360.com – QuasaVisit us at :http://www.mainfra 
 
screen(SYSOUT Dataset)
.
 
What is PERFORM Sta
One of the statements iStatement. The PERFORMspecified paragraph orThe general syntax of P
ERFORM <procedure-name
The procedure-name refejump to.Example:Consider the following0200-INDIA-PARA.The starting point is P1. The DISPLAY ‘START Odisplayed.2. PERFORM 0200-INDIA-PINDIA-PARA. All the staDISPLAY ‘INDIA’ printscomplete, the control rhad left off.3. The next statement Drinted to the output.pon running the above
r Chunawalames360.com 
s
 
hould be
ement used for? How does it control
n COBOL, to control the flow of theStatement basically transfers contrsection.ERFORM Statement is :
>
rs to the name of the paragraph or sCOBOL Program, that consists of a 01ROCEDURE DIVISION.F PROGRAM’ statement causes START OARA causes transfers the control(jutements in this paragraph are executINDIA to the output. After the 0200eturns back to the point(0100-MAIN-ISPLAY ‘END OF PROGRAM’ causes ENDThe program terminates at STOP RUN.COBOL Program, you should get the f
the program flow?
 
p
 
rogram is PERFORMl(jumps) to theection that, you want00-MAIN-PARA andPROGRAM to beps) to the 0200-ed one-by-one.INDIA-PARA isARA) from where itF PROGRAM to bellowing output -
 
Wednesday, 06 January 2010© Mainframes360.com – QuasaVisit us at :http://www.mainfra 
 
The procedure to whichsingle para, or multi-pThe general syntax to p
ERFORM paragraph-A TH
Suppose you have writtePARAGRAPH-C,...,upto Pcontrol(jumps) to the saragraphs B,C,D,...,Yaragraph PARAGRAPH-Z ifrom where it had leftExample:pon running the above
r Chunawalames360.com 
t
 
he PERFORM statement transfers contaragraph procedure.erform a multi-paragraph procedure
U paragraph-Z
n a sequence of paragraphs : PARAGRRAGRAPH-Z. The above PERFORM Statemtarting point – PARAGRAPH-A, then abetween A to Z are also executed. Ts executed, before the control returoff.COBOL Program, you should get the fr
 
ol, can be a 1s:PH-A, PARAGRAPH-B,nt transfersl the intermediateen, the lastns back to the pointllowing output -

Activity (10)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
lionkingsr liked this
kiranbtech1w liked this
Siva liked this
rajithathotakura liked this
naveenmsn liked this
naveenmsn liked this
amkumar29 liked this
yadnus7 liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->