Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REXX & DB2 & -922

Status
Not open for further replies.

stoggers

Vendor
May 30, 2001
93
US
Hi,

I am trying to select some data from a DB2 table using REXX and I am receiving a -922 (access failure) when attempting to connect to the DB2 subsystem.

Does anyone know which plans are involved in the DB2/REXX interface?

Thanks,

Stoggers.
 
Hi Stoggers,

You don't say which DB2 environment you're using.
On i-series you need to explicitly specify a read only cursor or have journalling applied to the table you're after
Also check that your have *READ rights to Collection/Table

This code works with REXX/400 DB2/400

/* LIST EMPLOYEES */
SAY ' '
SAY ' LIST OF EMPLOYEES'
SAY ' '

ADDRESS EXECSQL
SIGNAL ON ERROR
select_stmt = 'SELECT EFEMNO, EFSURN, EFFORN FROM CSEMPSPF FOR READ ONLY'

EXECSQL 'PREPARE S1 FROM :select_stmt'
EXECSQL 'DECLARE C1 CURSOR FOR S1'
EXECSQL 'OPEN C1 '
/* Fetch all of the rows */
DO UNTIL (SQLCODE <> 0)
EXECSQL 'FETCH C1 INTO :EMNO, :SURN, :FORN'

IF SQLCODE = 100 THEN
LEAVE

/* Print out the fetched row */

SAY EMNO ' ' SURN ' ' FORN
END;
EXECSQL 'CLOSE C1'
ERROR:
say 'Error SQLCODE: ' SQLCODE 'SQLSTATE: ' SQLSTATE


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top