MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rexx & SQL and multiple cursors

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 618
Topics: 172
Location: Stockholm, Sweden

PostPosted: Tue Jul 25, 2023 2:27 am    Post subject: Rexx & SQL and multiple cursors Reply with quote

Thought I'd append this since I had to experiment a bit with it to get it working.
Background is I've written a Rexx application that compares a DL/1 database key with it's root and child segments with the equivalent DB2 tables (that do not need to match segment for table).
The example that caused me grief for a while was the following unloaded DL/1 database
Quote:

DFFPB SFPBPNR
DFFPB SFPBFALL
DFFPB SFPBSJP
DFFPB SFPBSJP
DFFPB SFPBSJP
DFFPB SFPBFALL
DFFPB SFPBSJP
DFFPB SFPBSJP
DFFPB SFPBSJP

As can be seen (?), there is a root segment (SFPBPNR), then a child segment (SFPBFALL) which in turn can contain its own children (SFPBSJP).
My idea was to maintain a list of each segment, whether the equivalent DB2 cursor was open and what that cursor number was..
What I hadn't figured on was second SFPBFALL segment. It seems that the db2 descriptor for the second SFPBFALL didn't match that for the previous SFPBSJP, so I was receiving error
Quote:

SQLSTATE = 42806 SQLERRD = -314,0,0,384,1,0 SQLERRP = DSNXROHB SQLERRMC = 1
-° DSNT408I SQLCODE = -303, ERROR: A VALUE CANNOT BE ASSIGNED TO OUTPUT HOST
VARIABLE NUMBER BECAUSE THE DATA TYPES ARE NOT COMPARABLE
DSNT415I SQLERRP = SQL PROCEDURE DETECTING ERROR

on the second SFPBFALL fetch.

"Normally", this wouldn't be a problem, since you've probably only opened one cursor in your Rexx script, but here it was.
The simple solution was to change the code from
Code:

address dsnrexx "execsql fetch c"y" using descriptor :db2"

(where y was the cursor "number" for each segment/table)
to
Code:

address dsnrexx "execsql describe s"y" into :db2"         
address dsnrexx "execsql fetch c"y" using descriptor :db2"

after which the problem disappeared.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group