1. Charlie Cummins
  2. PowerBuilder
  3. Friday, 14 February 2020 21:51 PM


Running PB 2017 R3, using ODBC to connect to ASE database.

PB in-code stored procedures declares are failing on recompile the with following error (ran fine under ASE Native).  C0038: SQLSTATE = ZZZZZ[SAP][ASE ODBC Driver][Adaptive Server Enterprise]Must declare variable '@ll_rv.

Here is PB Code in question.

TRANSACTION ltr_transobj
integer li_rc
long ll_rv, ll_beg_ckno, ll_end_ckno
integer li_subsystem
string ls_batchid
string ls_result

ltr_transobj = THIS.of_get_transobj()
li_rc = 1
THIS.of_set_strerr_method( THIS.ClassName() + ".of_dbsp_isvalid_ckrng()" )

//======================================================================// check transaction object
IF IsValid( ltr_transobj ) THEN
// MessageBox( THIS.ClassName(), "Invalid Transaction Object, Contact IS.", StopSign!)
THIS.of_set_strerr_successful( FALSE )
THIS.of_set_strerr_error_code( -1 )
THIS.of_set_strerr_error_type( "System Error, Powerbuider" )
THIS.of_set_strerr_error_message( "Invalid Transaction Object, Contact IS." )
// return error structure
RETURN istr_error

// assign passed parameters
li_subsystem = ai_subsystem
ls_batchid = as_batchid
ll_beg_ckno = al_beg_ckno
ll_end_ckno = al_end_ckno

DECLARE lspcp_valid_ckrng PROCEDURE FOR @ll_rv = spcp_valid_ckrng
@int_subsystem = :li_subsystem,
@c_ckbatchid = :ls_batchid,
@int_ckbegno = :ll_beg_ckno,
@int_ckendno = :ll_end_ckno
USING ltr_transobj;



Maybe its just a ODBC setting or Declare syntax change?

Thanks for your help, Charlie


Charlie Cummins Accepted Answer Pending Moderation
  1. Tuesday, 18 February 2020 17:39 PM
  2. PowerBuilder
  3. # 1

First of all, thanks everyone for your responses.

In general, I am in the midst of doing an impact analysis on moving some old PB Applications (that make a lot of stored procedure calls) from ASE native drivers over to ODBC.  When the time comes we will be using MS SQL Server ODBC but I don't have a MS SQL Server database up yet for that so I am connecting to the ASE one using ODBC for a preliminary investigation.

I agree with Michael that ODBC doesn't like @ll_rc =

I tried adding DBParm="PBNewSPInvocation='Yes'" to my database connection but that didn't seem to help.  Would that be added as a ConnectString or ConnectOption?

Could somebody provide an example of binding variables at EXECUTE time instead of DECLARE?  I'm not familiar with that approach.

Thanks for your help, Charlie





There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 18 February 2020 17:01 PM
  2. PowerBuilder
  3. # 2

Hi Charlie;

   PB supports a native driver over to ASE. That is also the best route for ASE interactions IMHO. I would use that instead of ODBC  "middle-ware". Just my $0.02.


Regards ... Chris

There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Saturday, 15 February 2020 20:17 PM
  2. PowerBuilder
  3. # 3

In declare you refer to undefined SQL variable = @ll_rv whereas the other @-references are parameters. 

Consider using "new SP" parameter as Miguel suggests. Also consider binding variables at EXECUTE instead of DECLARE.


Forgot to mention: ODBC doesn't support " @ll_rv = ..." inside DECLARE PROCEDURE.

More info on syntax restrictions in documentation = "Connecting to Your Database"
  1. Michael Kramer
  2. Tuesday, 18 February 2020 16:04 PM
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 15 February 2020 13:14 PM
  2. PowerBuilder
  3. # 4
There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.