i-o-control statement error.

I have a piece of code which have been running fine in Net Express. When compiling the same in visual COBOL for IDE I am getting some error.


The error are : 

COBCH0071S PROCEDURE DIVISION missing or unknown statement


COBCH0082S COBOL Division or Section header encountered in incorrect order


Below is the part of the code with the lines highlighted which is giving me error.


001100 select temp-b-sec-in-file assign to ut-s-insort.
001100 select sort-file assign to ut-s-sortwk01.
001200 select temp-b-sec-out-file assign to ut-s-outsort.
006900 i-o-control.
007000 apply write-only on temp-b-sec-out-file.
002700 data division.
002800 file section.
012400 fd temp-b-sec-in-file
012500 recording mode is v
012600 block contains 0 records
012700 record contains 202 to 30704 characters
012800 label records are standard
012900 data records are temp-b-sec-rec-in-a,
013000 temp-b-sec-rec-in-b.

  • If you look in the Visual COBOL documentation in the COBOL Reference manual for I-O-control here you will see that the APPLY statement is marked as being supported in the OSVS dialect.

    This means that you are most likely using a different set of compiler directives for Visual COBOL than you were for Net Express. Try adding the DIALECT"OSVS" to the set of Visual COBOL directives but in order to ensure maximum compatibility between the two products you should use the exact same set of directives.

  • Hi Chris,

    Thank you for the quick reply.
    The dialect set is Micro Focus and not OSVS.

    When I go ahead and change the dialect to OSVS then it seeks code in native cobol format i.e. it looks for everything in upper case character. Is there anyway out to deal with this where-in I can change the dialect to OSVS but the compilation happens successfully without rewriting the code in upper-case.
  • Try setting the OSVS directive instead of the DIALECT"OSVS". That tells the compiler to recognize OSVS features but does not enforce the full OSVS dialect.
  • Verified Answer

    It also seems like the compiler allows APPLY WRITE-ONLY for all mainframe dialects not just OSVS, so maybe setting ENTCOBOL or something more up-to-date might be more appropriate than OSVS. It looks like there are other APPLY options which are OSVS only but not WRITE_ONLY.

    You should really check the list of NX directives you were turning on to ensure you are using the same set in VC.
  • Thank you so much Chris.
    ENTCOBOL as directive really solved my problem. Now all the codes are getting compiled successfully like a warm knife through a slab of butter. :) :)