Skip to main content

Hi all, 

I am writing here looking for some guidance. 

Recently we updated our DEV server.

Before we were using RHEL7 + Visual Cobol 4.11 + SQL Server 2012.

Now we are using RHEL8 + Visual Cobol 8.0 + SQL Server 2019.

After performing few tests, I found an issue on a SQL Instruction.

On both servers I used the very same data.

The issue is: On RHEL8 + Visual Cobol 8.0 + SQL Server 2019, when reading a cursor for the SECOND time, the fetch instruction reads que same first record, which gives SQLCODE -10000 and SQLSTATE S1010.

We did not change our makefile, we did not touch our code. On our server with visual cobol 4.11 the code works as expected. 

Has anyone here have experienced a similar issue when upgrading Visual Cobol? 

It is a simple cursor as we can see below

  5708     EXEC SQL
  5709        DECLARE CC-CURS-STATUT CURSOR FOR
  5710           SELECT contenu_carte_controle
  5711                 ,date_creation_carte_controle
  5712                 ,id_carte_controle
  5713             FROM cartes_controle
  5714            WHERE nom_carte_controle = :CC-NOM-CARTE              VC
  5715              AND SUBSTRING(statut_carte_controle, 1, 9) =        VC
  5716                  SUBSTRING(:CC-STATUT, 1, 9)                     VC
  5717           FOR UPDATE                                             VC
  5718     END-EXEC.

  5778        EXEC SQL
  5779           FETCH CC-CURS-STATUT
  5780            INTO :CC-CONTENU, :CC-DATE-CREATION, :CC-ID
  5781        END-EXEC

I appreciate any guidance here.

Thank you in advance.

Best regards,

Thiago


#COBOLSQLCOBSQL
#SQL
#VisualCOBOL
#COBOLVISUALCOBOLMIGRATION
#COBOL

Hi all, 

I am writing here looking for some guidance. 

Recently we updated our DEV server.

Before we were using RHEL7 + Visual Cobol 4.11 + SQL Server 2012.

Now we are using RHEL8 + Visual Cobol 8.0 + SQL Server 2019.

After performing few tests, I found an issue on a SQL Instruction.

On both servers I used the very same data.

The issue is: On RHEL8 + Visual Cobol 8.0 + SQL Server 2019, when reading a cursor for the SECOND time, the fetch instruction reads que same first record, which gives SQLCODE -10000 and SQLSTATE S1010.

We did not change our makefile, we did not touch our code. On our server with visual cobol 4.11 the code works as expected. 

Has anyone here have experienced a similar issue when upgrading Visual Cobol? 

It is a simple cursor as we can see below

  5708     EXEC SQL
  5709        DECLARE CC-CURS-STATUT CURSOR FOR
  5710           SELECT contenu_carte_controle
  5711                 ,date_creation_carte_controle
  5712                 ,id_carte_controle
  5713             FROM cartes_controle
  5714            WHERE nom_carte_controle = :CC-NOM-CARTE              VC
  5715              AND SUBSTRING(statut_carte_controle, 1, 9) =        VC
  5716                  SUBSTRING(:CC-STATUT, 1, 9)                     VC
  5717           FOR UPDATE                                             VC
  5718     END-EXEC.

  5778        EXEC SQL
  5779           FETCH CC-CURS-STATUT
  5780            INTO :CC-CONTENU, :CC-DATE-CREATION, :CC-ID
  5781        END-EXEC

I appreciate any guidance here.

Thank you in advance.

Best regards,

Thiago


#COBOLSQLCOBSQL
#SQL
#VisualCOBOL
#COBOLVISUALCOBOLMIGRATION
#COBOL

Are you using the same compiler directives file on both systems?
Perhaps you didn't copy over your COBOL.DIR or other directives file from the old system?

This normally happens when a COMMIT is done between fetches which, depending on the setting of the BEHAVIOR directive will close the cursor and the next fetch will yield a -10000, function sequence error.

Try adding the following directive to your compile:

SQL(CLOSE_ON_COMMIT=NO}


Are you using the same compiler directives file on both systems?
Perhaps you didn't copy over your COBOL.DIR or other directives file from the old system?

This normally happens when a COMMIT is done between fetches which, depending on the setting of the BEHAVIOR directive will close the cursor and the next fetch will yield a -10000, function sequence error.

Try adding the following directive to your compile:

SQL(CLOSE_ON_COMMIT=NO}

Thank you very much Chris, that is a pretty solid advice. 

I am using the very same directives file on both systems. 

Zero changes.

/esil/test/src (master)>make m0407prg
cob -C CALLFH=DBIXFH -C 'WARNING"2" VSC2 IBMCOMP REF NODETECTLOCK REMOVE(METHOD) REMOVE(TRACE) LIST() DEFAULTBYTE"00" SQL(DBMAN==ODBC, TARGETDB==MSSQLSERVER, BEHAVIOR==ANSI)' -x -g -k m0407prg.cbl -o m0407prg -L/tipix//lib -L../lib -L/public/prod/lib -lsilbatsub -lpubbatsub -ldbixio -ldbirun -ldbi2 -lbat -L /tipix/lib -m ixfile=cixfile +l disam -lcurses -lm 2>&1 | tee m0407prg.err
mv -f m0407prg ../bin
rm -f m0407prg.idy m0407prg.int m0407prg.lst m0407prg.o m0407prg.err

As you said we do have commits between fetches. 

What is strange is everything works fine with Visual Cobol 4.

Maybe this is something that microfocus fixed later on.

I will test this new directive asap.

Thank you again Chris.


Are you using the same compiler directives file on both systems?
Perhaps you didn't copy over your COBOL.DIR or other directives file from the old system?

This normally happens when a COMMIT is done between fetches which, depending on the setting of the BEHAVIOR directive will close the cursor and the next fetch will yield a -10000, function sequence error.

Try adding the following directive to your compile:

SQL(CLOSE_ON_COMMIT=NO}

Chris, it worked like a charm now. A big thank you.