View previous topic :: View next topic
|
Author |
Message |
trilokdewangan
New User
Joined: 19 Jun 2008 Posts: 39 Location: USA
|
|
|
|
Hi,
I am writing a code to execute SQL query using rexx . I need to connect DB2 system to rexx query. When I hard code SSID (Ex DBB5), I am able to run the query. But I have so many DB2 regions (like DBB1, DBA1, DBB5, DBB4). I can't hardcode this value.
Is there any way to get SSID value in rexx program it self? I mean when I loginn to DBB5 region I am able to execute the query in DBB5 region and so on with out giveing SSID value. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Have you tried setting a variable to the value of the SSID required and using that ?
Post your code so that we may see what you are doing |
|
Back to top |
|
|
trilokdewangan
New User
Joined: 19 Jun 2008 Posts: 39 Location: USA
|
|
|
|
Here is the code. I want some keyword or variable to get SSID value from ISPF envorinement. I can change the owner name of table once I get the SSID value.
Code: |
"ISREDIT MACRO "
Clientid = ""
ADDRESS TSO "SUBCOM DSNREXX" /* DSN Rexx environment available?*/
if rc then
do
s_rc= RXSUBCOM('ADD','DSNREXX','DSNREXX')
end
arg plannumber
SSID = 'DBA1'[b] (This is Hardcoded, I want some variable to get SSID from program it self) [/b]
ADDRESS DSNREXX "CONNECT" SSID
if SQLCODE \= 0 then
Do
say 'Sql Error during connect to subsystem:' SSID
End
table = Qualifier || '.HKTA0010'
value1 = plannumber
/* prepare the sql statment */
sqlStmt = "SELECT DISTINCT CLIENT_ID"
sqlStmt = sqlStmt ||" FROM " AXRT74DA.HKTA0010 WHERE
sqlStmt = sqlStmt ||" PLAN_NUMBER='"value1"' WITH UR"
/* execute the sql statment */
ADDRESS DSNREXX "EXECSQL DECLARE C1 CURSOR WITH HOLD FOR S1"
ADDRESS DSNREXX "EXECSQL PREPARE S1 INTO :SQLDA FROM :SQLSTMT"
ADDRESS DSNREXX "EXECSQL OPEN C1"
If SQLCODE \= 0 then
do
say ' SQL error :' SQLCODE
EXIT 0
end
num=0
Do while sqlcode = 0
/*Fetch the cursor */
ADDRESS DSNREXX "EXECSQL FETCH C1 USING DESCRIPTOR :SQLDA"
if sqlcode =0 then
do
num = num+1
Client_id = sqlda.1.sqldata
Clientid.num = Client_id
say'client_id :' Clientid.num
end
else
if num = 0 then
say ' No record found'
End
ADDRESS DSNREXX "EXECSQL CLOSE C1"
/* End of the program */
EXIT 0 |
|
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
In my shop, the following code works:
Code: |
/* REXX */
ADDRESS ISPEXEC "VGET (DSNEOV01) PROFILE"
SAY DSNEOV01
EXIT
|
O. |
|
Back to top |
|
|
trilokdewangan
New User
Joined: 19 Jun 2008 Posts: 39 Location: USA
|
|
|
|
Hi Ofer71,
I used your code and tested in my system, It doesn't work. I tried to find similar name like DSMOV01, I didn't get.
Please suggest. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
You probably have the SSID in other variable...Here's how I found mine:
1. Go to option 7.3
2. SORT VALUE
3. Find the name of the variable containing the SSID name.
O. |
|
Back to top |
|
|
trilokdewangan
New User
Joined: 19 Jun 2008 Posts: 39 Location: USA
|
|
|
|
Thank You O.
Actually I searched 7.3 variables for SSID but I didn't get. I got another variable for System ID i. e. ZSYSID which is unique for all regions. I used that variable and completed my rexx coding and it works.
Thanks again. |
|
Back to top |
|
|
Vishwamurthy
New User
Joined: 11 Mar 2008 Posts: 57 Location: India
|
|
|
|
Option 7.3 for "Variables" has not helped me..
ZSYSID shows me the System name.. There is no SSID in that.. My system has two DB2 regions DSN1 and DSN8, and I am using the first one. None of them showed up..
I have another doubt too..
Please explain me how we can update row of a DB2 table using Host variables in REXX.
I have been successful in issuing a select query using Host variables in REXX program. Thanks to IBMMAINFRAMES.com . |
|
Back to top |
|
|
|