title: Is there a way to use INSPECT TALLYING with a check for multiple characters?
body: <p>I have a string for which I wish to tally the count of characters till a certain pattern of characters is found.</p>
  
  <p>For example:</p>
  
  <p>Give a string: <code>askabanskarkartikrockstar</code> <br>
  I would like to know how many characters are there before the <code>kartik</code> in the string.</p>
  
  <p>In a normal scenario where I need to find the number of characters before, say <code>k</code>, in the given string, I would write the code somewhat as:</p>
  
  <pre><code>INSPECT WS-INPUT-STRING TALLYING CT-COUNTER FOR CHARACTERS BEFORE LT-K
  </code></pre>
  
  <p>Where </p>
  
  <ul>
  <li><code>WS-INPUT-STRING</code> is alphanumeric with a value of
  <code>askabanskarkartikrockstar</code>,</li>
  <li><code>CT-COUNTER</code> is the counter used to count the number of characters</li>
  <li><code>LT-K</code> is a literal with the value <code>k</code>.</li>
  </ul>
  
  <p>But here, if I wish to do the same for a sub-string, like <code>kartik</code> in the above example, would replacing the value of <code>LT-K</code> with <code>kartik</code> instead of just <code>k</code> work? If yes, is the same applicable for alphanumeric literals that have values in the form of hexadecimal numbers (for example, in a literal <code>X(02)</code> one stores a new-line character as <code>x'0D25'</code>)?</p>
  
  <p>I'm trying to implement the above code in zOS IBM mainframe v10. Thanks.</p>