Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You PERFORM B900-COUNT-POLICIES only once, after the end-of-file is already reached. </p> <p>B900- also just uses whatever value T2-INDEX last had.</p> <p>You have two main choices: either a loop to do it; or, assuming that your territory is zero to less-than-or-equal-to nine - in which case you can use the value of the territory to set the value for your index and just add. SEARCH is possible (the reason it didn't work for you was still the execution of the paragraph only after end-of-file, not with each record), but in my experience it is not a method that is chosen for this type of task.</p> <p>If you want to use the territory to get the value for the index to use for the ADD, use SET:</p> <pre><code>SET T2-INDEX TO rec-94-territory-code </code></pre> <p>Except you can't. rec-94-territory-code is an alpha-numeric (a PIC X field. This is good for anything not used in a calculation). It is unproblematic to define a new numeric field in your WORKING-STORAGE and first</p> <pre><code>MOVE rec-94-territory-code TO new-numeric-field </code></pre> <p>then</p> <pre><code>SET T2-INDEX TO new-numeric-field </code></pre> <p>For the loop, I think you can already get there.</p> <p>However, before you do any adding either way, it would be a good idea if your per-territory counts started off at zero. Yours state off at space. Even if that "works", it is not good practice.</p> <p>So you need to start those from zero - a loop is good for now.</p> <p>In the light of your code changes, your next problem is how you've attempted to set initial values to your table of counts.</p> <p>For now, add a paragraph after your OPEN paragraph and PERFORM that new paragraph. In that paragraph, make a loop to set the values in your table to zero, starting from the first and ending with the ninth.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload