COBOL Examine:

COBOL Inspect Statement COBOL String Statement

Advertisements


EXAMINE and INSPECT are used for same purpose.

Syntax is almost same for both EXAMINE and INSPECT.

INSPECT is using now a days, which replaced the EXAMINE.

The EXAMINE statement is an HP extension to the ANSI COBOL standard.

EXAMINE has been replaced by the INSPECT statement.

If there any requirement to use EXAMINE in coding point of view, it is advisable to use the INSPECT statement instead of EXAMINE.


Practical Example:


						
 IDENTIFICATION DIVISION.                                       
 PROGRAM-ID. EXAM.                                              
 ENVIRONMENT DIVISION.                                           
 DATA DIVISION.                                                  
 WORKING-STORAGE SECTION.                                        
 01 WS-DATA		PIC X(10) VALUE ‘DD-MM-YYYY’.          
 01 WS-CNT 	 	PIC 9(02) VALUE ZEROES.                
 PROCEDURE DIVISION.                                             
     DISPLAY 'EXAMINE TALLYING REPLACING....'.                   
     EXAMINE WS-DATA TALLYING WS-CNT ALL ‘-’                     
     REPLACING ALL ‘-‘ BY ‘/’.                                   
     DISPLAY 'DATA AFTER TALLYING REPLACING : 'WS-DATA.          
     DISPLAY 'COUNT OF - LETTER IS : 'WS-CNT.                   
     STOP RUN.                                                   


COBOL Inspect Statement COBOL String Statement

Advertisements