Highlighted
Absent Member.
Absent Member.
1040 views

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

Jump to solution

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

Hi,

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).

Regards,
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: OpenESQL and "VAR ... IS ..." statement

Jump to solution
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...

View solution in original post

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: OpenESQL and "VAR ... IS ..." statement

Jump to solution
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?

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: OpenESQL and "VAR ... IS ..." statement

Jump to solution
The error occurs on :

EXEC SQL VAR WOR-NPVH IS VARCHAR2 END-EXEC.


when it is located in Working Storage Section. The same line located in Procedure Division precompiles with no error.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: OpenESQL and "VAR ... IS ..." statement

Jump to solution
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...

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.