![]() |
|
#1
|
||||
|
||||
|
I have an exec that I am working on to list the format of any table.
Here is the essence of it. I'll hide the elaborate call of SQL and it's error trapping... Code:
Code:
From the SQL Codes lookup I get... -981 THE SQL STATEMENT FAILED BECAUSE THE RRSAF CONNECTION IS NOT IN A STATE THAT ALLOWS SQL OPERATIONS, REASON reason-code. Explanation: The application attempted to execute an SQL operation, but the RRSAF connection was not in a state that allows the processing of SQL statements. System action: The statement cannot be executed. Programmer response: The reason code is described in Codes. Correct the error in the application, REBIND, and run the application again. SQLSTATE: 57015 The same query actually works fine in DSNTEP2... Code:
Any ideas guys? I wondered if I need to compile the exec? Steve ![]() |
|
#2
|
|||
|
|||
|
Your DSNTEP2 example.
I wrote a couple of execs to take the results from DSNTEP2 and format them as portrait or landscape results. I got sick of trying to "read" the results and keeping the "wrapped" lines in perspective. |
|
#3
|
||||
|
||||
|
Steve,
whatever module you are using to establish a db2 connection, is attempting an RRSAF connect. and failing. I have never seen a REXX script accessing db2 require a connection via RRS. a DSNLR.. instead of a DSNLI.. module is being invoked. other than that, I know nothing.... you can modifiy your sql to SELECT substring(name,1,18) as name and all the rest of the columns. LENGTH AS LEN, etc... and 'squeeze the return & column headings into a 121 format. Unless of course, you have somany column in your result set that you will wrap, anyway.
__________________
Dick Brenholtz American in Varel, Germany |
|
#4
|
||||
|
||||
|
I wrote a REXX here to display the layout of a DB2 table along with RI relationships, indexes, and triggers. It has some site-specific code in it so you would have to deal with ripping that out yourself, but I'll share all of the code with anyone that asks for it. Send an email to "petwir @ saif {dot} com", and put "SFDESC" in the subject line.
In reviewing my REXX code, I noticed it also requires the use of some homegrown software for allocating and de-allocating the DB2 libraries that I don't have access to the source code for. So for my REXX code to be of value to you, you would need to be able to resolve this issue on your own as well. Here is a sample output; Code:
Last edited by petwir : 07-23-2010 at 01:02 PM. |
|
#5
|
|||
|
|||
|
Don't see it, but did you issue a "CONNECT" to the DB2 Subsystem before trying to run SQL?
__________________
Ron |
|
#6
|
||||
|
||||
|
Hej Michael,
I really tried the DSNTEP2 only as a double-check to make sure that the SQL did not have any stupidly obvious flaws. I haven't done any real DB2 development since I worked on RETAIN reports in UK in 1999 (using RXSQL), although I did some data warehouse export work similar to this on a short project about 5 years ago for Ericsson here in Sweden. I'm keen to get a pukka DSNREXX solution to see if I have made some stupid error using this API, perhaps in initialization of variables, but I cannot see anything. Steve ![]() |
|
#7
|
||||
|
||||
|
You are failing on the PREPARE, right?
Here is what the PREPARE code looks like in my application. Its a little different than yours; Code:
|
|
#8
|
||||
|
||||
|
Thanks Pete,
I do my "INTO" bit after on the "FETCH" ...if I can get that far! I'm pretty sure that I have done this, just like this before. Code:
Steve ![]() |
|
#9
|
||||
|
||||
|
Ah, apples and oranges. My FETCH is coded like so;
Code:
I think the reason for the different forms, is that my cursor handling logic is inside a generic REXX subroutine that doesn't know what columns it needs to handle. So by using OUTSQLDA, it dynamically handles whatever columns you choose to select. Since we've put all of our DB2 access stuff into a subroutine, our REXX applications don't have to deal with any DSNREXX instructions at all. They simply pass the SQL statement to the subroutine and get the results back. |
|
#10
|
||||
|
||||
|
I wonder if your state-problem is resolved by logging off and back on? It could be that a prior test left a connection open and when you try again, it collides with the prior connection? (just guessing)
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|