Home > Software > Mainframe > Cobol
Interview Questions   Tutorials   Discussions   Programs   

Cobol - What are declaratives in COBOL ?




947
views
asked mar August 3, 2014 02:24 AM  

What are declaratives in COBOL ?


           

1 Answers



 
answered By Mswami   0  
Declaratives – USE statement

COBOL provides an option to group all the possible errors of specific operation(s) in a place and that will be automatically invoked during the respective operation(s) of any file. This avoids redundant code.
This is done in DECLARATIVE section of the procedure division. DECLARATIVE should be the first section in the procedure division if coded.

Example:

PROCEDURE DIVISION.
DECLARATIVES.
USE-PROCEDURE SECTION.
	USE AFTER EXCEPTION PROCEDURE ON INPUT
ERROR-PROCEDURE.
	Check the file-status code for validity.	
END-DECLARATIVES.	 

Whenever there is an error in the processing of ANY FILE opened in INPUT mode, then the control comes to ERROR-PROCEDURE. The validity of error should be checked in this paragraph and allow or restrict the process down, based on severity of error code.

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert