Skip to Content
Custom Search

INSPECT TALLYING FOR ALL IDENTIFIER

 

INSPECT TALLYING FOR ALL IDENTIFIER
 
 
The following COBOL program depicts the use of 
INSPECT TALLYING FOR ALL IDENTIFIER
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM029.
       AUTHOR. MAINFRAMEWIZARD.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 TEST-STRING   PIC X(40) VALUE SPACES.
       01 WS-COUNTER    PIC 9(9)  VALUE ZEROES.
       01 SEARCH-STRING PIC X(2)  VALUE SPACES.
       PROCEDURE DIVISION.
       10000-MAIN-PARA.
             MOVE 'USE OF INSPECT DEPICTED BY MAINFRAMEWIZARD.COM'
              TO  TEST-STRING
             MOVE 'CT'
              TO  SEARCH-STRING
             INSPECT TEST-STRING TALLYING WS-COUNTER FOR ALL
               SEARCH-STRING
             DISPLAY 'COUNT OF ALL SEARCH-STRING IN STRING IS = '
               WS-COUNTER
             STOP RUN.
 
The output of the program is 
 
COUNT OF ALL SEARCH-STRING IN STRING IS = 000000002                                                                      

Comments

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 49 guests online.
Dr. Radut | page