OpenESQL and "VAR ... IS ..." statement

[Migrated content. Thread originally posted on 16 September 2011]


I'm migrating programs precompiled with Procob to OpenESQL and there's a problem on "VAR ... IS... " statements when they are put in Working Storage section. OpenESQL ends with error "ES0114 Statement only allowed in the PROCEDURE DIVISION." whereas Procob compiles without any error.

Is there a precomp option that could avoid this? (the VAR ... IS statements are in copy files used by many, many programs, so I can't change it very simply).

  • The OpenESQL preprocessor is not 100% compatible with the Pro*COBOL preprocessor from Oracle especially if you use Oracle extensions in your program.

    Can you please give me an example of what the full statement looks like on which this error is occurring?

  • The error occurs on :


    when it is located in Working Storage Section. The same line located in Procedure Division precompiles with no error.
  • Verified Answer

    The problem that you are seeing is that this is an Oracle Pro*COBOL extension and it is not supported in OpenESQL either in the working-storage section or in the procedure division.

    The reason that you see the error that you do is that OpenESQL tries to be very flexible in what it allows since it is designed to work with just about any data source and it only recognizes as much SQL syntax as it has to.

    The preprocessor figures out that the statement isn’t a data declaration, but in the procedure division it just assumes it’s server-specific syntax and passes it through at runtime.

    If you actually try and execute the statement it will fail.

    If you turn on SQL(CHECK) then it will fail at compile time.

    You will need to remove this type of Oracle syntax and use SQL TYPE IS in the host variable declaration.

    Sorry about that...