Skip to main content

Hello, this is my first ever post, so here goes:

We are trying to implement a FETCH ABSOLUTE in a MF Cobol program.  Here is what I found:

When I try to code the fetch statement, I can use the following arguments: NEXT, PRIOR, FIRST, and LAST.  However, when I use ABSOLUTE or RELATIVE, it fails compile.  I included the SCROLL option when declaring the cursor.  I read that If the SCROLL is specified in an ISO style DECLARE CURSOR, all FETCH options are supported.  However, I still fail compile using the ABSOLUTE FETCH option.

Here is the cursor declaration:

EXEC SQL
   DECLARE CSRF00 scroll cursor FOR SELECT *
           FROM :WS-NAME-NO-EXTENSION A
END-EXEC

And here is the FETCH ABSOLUTE. 

EXEC SQL
   FETCH ABSOLUTE 2 FROM CSRF00 INTO :dclf00
END-EXEC

So, is my syntax wrong or is ABSOLUTE really not supported.

Thanks in Advance,

Bart


#cobolnetexpress
#SQLOpenEsqlNetExpressCobol

Hello, this is my first ever post, so here goes:

We are trying to implement a FETCH ABSOLUTE in a MF Cobol program.  Here is what I found:

When I try to code the fetch statement, I can use the following arguments: NEXT, PRIOR, FIRST, and LAST.  However, when I use ABSOLUTE or RELATIVE, it fails compile.  I included the SCROLL option when declaring the cursor.  I read that If the SCROLL is specified in an ISO style DECLARE CURSOR, all FETCH options are supported.  However, I still fail compile using the ABSOLUTE FETCH option.

Here is the cursor declaration:

EXEC SQL
   DECLARE CSRF00 scroll cursor FOR SELECT *
           FROM :WS-NAME-NO-EXTENSION A
END-EXEC

And here is the FETCH ABSOLUTE. 

EXEC SQL
   FETCH ABSOLUTE 2 FROM CSRF00 INTO :dclf00
END-EXEC

So, is my syntax wrong or is ABSOLUTE really not supported.

Thanks in Advance,

Bart


#cobolnetexpress
#SQLOpenEsqlNetExpressCobol

Hi Bart,

The statement that you read about using the scroll option in the cursor declare applies to statements written in SQL Server Transact-SQL language and does not apply to syntax supported in OpenESQL which is the Micro Focus SQL preprocessor.

The list of available options in MF COBOL can be found in the Net Express COBOL docs under OpenESQL statements -> FETCH. The list does not include ABSOLUTE or RELATIVE.

If you wish to use options that are not listed there you still might be able to do so by creating your statements using dynamic SQL instead of directly in embedded SQL or place your Transact SQL code within a stored procedure in SQL Server and call it to execute the statements.