IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX DB2 issue


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ajay_diaz
Warnings : 1

New User


Joined: 12 Sep 2005
Posts: 28

PostPosted: Thu Jul 02, 2009 4:52 pm
Reply with quote

Hello!
I am executing the below code to fetch the TSNAME for a table from database . My requirement is to display TSNAME on panel after user enters SSID and table name in the panel.
The issue is that the TSNAME is always blank on panel. I am not sure whether the problem is with DB2 query or my REXX program / panel. When I am executing the query in QMF it is fetching the result correctly. Please help me with this.

The code is as shoen below.

/*REXX*/
/*TRACE I */


" ISPEXEC LIBDEF ISPPLIB DATASET ID("USER.REXX.UTILS")" ;
IF RC \= 0 THEN
CALL RTNTHROWERRORMESSAGE 1, RC;

"ISPEXEC DISPLAY PANEL (PNLTSNME)";

/* GET THE INPUTS FROM THE USER */
"ISPEXEC VGET (SSID, TBNAME) PROFILE";
TBL_NAME = "'" || TBNAME || "'"

ADDRESS TSO "SUBCOM DSNREXX"

S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
IF S_RC <> 0 THEN
SAY 'PROBLEM LOADING DB2 ENVIRONMENT'
ELSE
ADDRESS DSNREXX
"CONNECT" SSID
IF RC = 0 THEN DO
SQLSTMT = "SELECT TSNAME FROM SYSIBM.SYSTABLES
WHERE TSNAME <> 'SYSDBAUT' AND
NAME =" TBL_NAME

ADDRESS DSNREXX "EXECSQL PREPARE S1 INTO :SQLDA FROM :SQLSTMT"
ADDRESS DSNREXX "EXECSQL DECLARE C1 CURSOR FOR S1"
ADDRESS DSNREXX "EXECSQL OPEN C1"

IF RC = 0 THEN DO UNTIL (SQLCODE <> 0)
ADDRESS DSNREXX "EXECSQL FETCH C1 USING DESCRIPTOR :SQLDA"
SAY SQLCODE
IF SQLCODE = 0 THEN
ADDRESS DSNREXX "EXECSQL FETCH C1 INTO :PTSNAME"
END
END
ADDRESS DSNREXX "EXECSQL CLOSE C4"
ADDRESS DSNREXX "DISCONNECT"
S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')

/* TO DISPLAY THE PANEL */
ADDRESS TSO "ISPEXEC DISPLAY PANEL (PNLTSNME)";

ADDRESS TSO "ISPEXEC VPUT (SSID, TBNAME, PTSNAME) PROFILE";

RETURN;
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 4:59 pm
Reply with quote

why display the panel and then populate the variables?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jul 02, 2009 5:15 pm
Reply with quote

And do the panel variables match the REXX variables ?
Back to top
View user's profile Send private message
ajay_diaz
Warnings : 1

New User


Joined: 12 Sep 2005
Posts: 28

PostPosted: Fri Jul 03, 2009 2:57 pm
Reply with quote

ooppss...stupid me!!
I was displaying the panel before populating the values.
It's working fine now.
Thanks Dick!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top