I HAVE A DOUBT IN COBOL



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

I HAVE A DOUBT IN COBOL

Postby vishnu8766 » Wed Jul 29, 2015 11:24 am

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......
vishnu8766
 
Posts: 3
Joined: Wed Jul 29, 2015 11:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: I HAVE A BOUBT IN COBOL

Postby BillyBoyo » Wed Jul 29, 2015 12:38 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: I HAVE A BOUBT IN COBOL

Postby vishnu8766 » Thu Jul 30, 2015 5:19 pm

thanks Billy...........
vishnu8766
 
Posts: 3
Joined: Wed Jul 29, 2015 11:15 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post