Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To get that Implicit Close message, you must have a STOP RUN before you close the file. </p> <p>You have a STOP RUN in paragraph FOUTJE, before the file is closed, so paragraph FOUTJE is being used. </p> <p>You use paragraph FOUTJE in a PERFORM when PRODUCT-NIET-GEVONDEN is true. </p> <p>PRODUCT-NIET-GEVONDEN is set to true on the INVALID KEY of the READ. </p> <p>So INVALID KEY is true.</p> <p>You get a FILE STATUS of ZERO. Unexpected, but fits what you have presented.</p> <p>I don't have COBOL-IT and I don't know what OS you are using.</p> <p>I also don't know in your set-up what a READ of a keyed file which does not explicitly reference a key does.</p> <p>I don't know in any set-up, because I don't do it. If I'm doing a keyed read, I always specify the key. </p> <p>I don't put data in the key on the file. I use a WORKING-STORAGE field for the key.</p> <p>Why, well, implementation-dependent for the compiler, but unless your file is OPEN and unless there is a current record on the file, then the content, even the address, of a file record is/can be (implementation dependent) undefined.</p> <p>As far as I am concerned, the KEY on the SELECT is to define the presence of the key on the file. The key you are using to READ the file obviously comes from elsewhere.</p> <p>So, I would remove these:</p> <pre><code> MOVE ZEROS TO PRODUCT MOVE WS-PRODUCTID TO PRODUCTID </code></pre> <p>I'd change this to include the KEY of WS-PRODUCTID</p> <pre><code> READ PRODUCTEN INVALID KEY SET PRODUCT-NIET-GEVONDEN TO TRUE </code></pre> <p>I'd not use INVALID KEY, I'd just use the value of WS-FILE-STATUS, which I'd expect to be "23" for "not found". I'd do the test with an 88. You then don't need your "flag" (FOUT and PRODUCT-NIET-GEVONDEN) anyway. Check the FILE STATUS field after each IO. This time you spelled your filename correctly, another time you won't and you may waste more time chasing your tail.</p> <p>Work on consistent indentation, it will make your program easier to read, for you, and anyone else.</p> <p>If you want to use DISPLAY to verify the logical path, you need to DISPLAY the value which is used to determine the logical path (FOUT in this case).</p> <p>There are two "formats" of the READ statement. One is for sequential reads, one is for reads using a key. When each is reduced to its mandatory-only content, they are identical. Therefore it is not clear, per compiler, which type of READ is the default (when not explicit) or when it is the default (per file). So I always make it explicit:</p> <pre><code>READ PRODUCTEN KEY IS WS-PRODUCTID </code></pre> <p>I would then use the FILE STATUS field to determine whether the key was read (00 in the status) or not found (23) or something else (something else).</p> <p>NOTE: This Answer as a resolution to your problem only works if everything is as you have described. Further information may invalidate this Answer as a Resolution.</p> <p>The Answer does work as a generally clearer (therefore better) way to code your COBOL program.</p> <p>Turns out to have been a suspected corrupted file. This <em>may</em> have caused a disparity between INVALID KEY and FILE STATUS, but in the normal course of events that is not going to happen. It is the only thing which fits all the evidence, but this is an exceptional case, perhaps not able to reproduce without the exact-same file corruption and clutching at this straw in a general case for why a given program is not working is probably the first refuge of a scoundrel.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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