Skip to Content
Custom Search

COBOL INSPECT TALLYING FOR ALL LITERAL

 

INSPECT TALLYING FOR ALL LITERAL
 
The following COBOL program depicts the use of 
INSPECT TALLYING FOR ALL LITERAL
 
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM028.
       AUTHOR. MAINFRAMEWIZARD.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 TEST-STRING PIC X(40) VALUE SPACES.
       01 WS-COUNTER  PIC 9(9)  VALUE ZEROES.
       PROCEDURE DIVISION.
       10000-MAIN-PARA.
             MOVE 'USE OF INSPECT DEPICTED BY MAINFRAMEWIZARD.COM'
              TO  TEST-STRING
             INSPECT TEST-STRING TALLYING WS-COUNTER FOR ALL 'T'
             DISPLAY 'COUNT OF ALL T IN STRING IS = ' WS-COUNTER
             STOP RUN.
 
 
The output of the program is 
 
COUNT OF ALL T 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 24 guests online.
Dr. Radut | page