Skip to Content
Custom Search

INSPECT TALLYING FOR CHARACTER BEFORE INITIAL SPACES

 

INSPECT TALLYING FOR CHARACTER BEFORE INITIAL SPACES
 
The following COBOL program depicts the use of 
INSPECT TALLYING FOR CHARACTER BEFORE INITIAL SPACES
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM033.
       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 'THIS IS TEST STRING TO TEST LEADING SPACES'
              TO  TEST-STRING
             INSPECT TEST-STRING TALLYING WS-COUNTER FOR
             CHARACTERS BEFORE INITIAL SPACES
             DISPLAY 'CHARACTERS BEFORE INITIAL SPACES = '
               WS-COUNTER
             STOP RUN.
 
 
 
The output of the program is 
 
CHARACTERS BEFORE INITIAL SPACES = 000000004                                                                             

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 1 user and 37 guests online.

Online users

  • edwnemmcfs
Dr. Radut | page