Consultor Eletrônico



Kbase P93463: Unable to Run DB2/400 Data Area API's
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/10/2004
Status: Unverified

FACT(s) (Environment):

Progress 9.x
Progress/400 DataServer

SYMPTOM(s):

Unable to use data areas on AS/400

Getting status -1 returned when using rtvdata.p or snddata.p

Status -1 means either the DB2/400 database name is incorrect or the database is not connected.

Multiple Progress databases connected as well as the schema holder and AS/400 database

CAUSE:

The way the API's for the data areas were written, they need to have the schema holder as the first database connected so it is defined as DICTDB. This will allow the _db record of the AS/400 to be found. The original API's look for the first _db record which has a name equal to the AS/400 but if other database are connected the client will only look at the Progress database that was connect first.

FIX:

A workaround to this problem is to add the following code to the procedure which calls the data area API.

/* Beginning of code to add */
DEFINE VARIABLE db-name AS CHARACTER NO-UNDO.
DEFINE VARIABLE old-dictdb AS CHARACTER NO-UNDO.

ASSIGN db-name = <name of your DB2/400 database>
old-dictdb = PDBNAME("DICTDB").

_dbloop:
DO i = 1 TO NUM-DBS:
IF (PDBNAME(i) = db-name OR LDBNAME(i) = db-name) AND CONNECTED(db-name) THEN DO:
CREATE ALIAS DICTDB FOR DATABASE VALUE(SDBNAME(i)).
LEAVE _dbloop.
END.
END.

/* Here is where you add the code for running either the as4dict/rtvdara.p to
retrieve data from the area or as4dict/snddara.p to send data.
After processing your information make sure you reassign the DICTDB alias
to the same database it was before your changed it above.
*/

DELETE alias DICTDB.
CREATE ALIAS DICTDB FOR DATABASE VALUE(old-dictdb).

/* end of code to add */

The _dbloop will find the DB2/400 _db record and set the DICTDB alias to the schema holder while the API's are being run. It will then set the alias back to the original database at the end.