Page 1 of 1

I HAVE A DOUBT IN COBOL

PostPosted: Wed Jul 29, 2015 11:24 am
by vishnu8766
currently i am working in a company which is based on mainframes cobol work.
and i am re-modifying the code which already exist.

if condition then
statement1
statement2.

if condition then
statement1
statement2.

how it execute can any one explain this please......

Re: I HAVE A BOUBT IN COBOL

PostPosted: Wed Jul 29, 2015 12:38 pm
by BillyBoyo
If "condition" is true, statement1 and statement2 will be executed. If, after that, "condition" is still true, statement1 and statemen2 will be executed again.

That's horrible code. Indentation helps humans to read. Using END-IF instead of a full-stop/period also helps.

Since the 1985 COBOL Standard the requirements for full-stops/periods in the PROCEDURE DIVISION have been much reduced. Take advantage of that. You'll avoid many stupid errors.

Full-stop/period is required: on PROCEDURE DIVISION header; before paragraph/SECTION; to terminate paragraph/SECTION label; to terminate program.

To terminate a paragraph/SECTION and a program, include a single line with a full-stop/period in column 12, ie have no code with a full-stop/period on. It'll make life much easier.

Re: I HAVE A BOUBT IN COBOL

PostPosted: Thu Jul 30, 2015 5:19 pm
by vishnu8766
thanks Billy...........