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

How to get SSID in rexx code


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

New User


Joined: 19 Jun 2008
Posts: 39
Location: USA

PostPosted: Wed Dec 03, 2008 3:49 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Dec 03, 2008 4:21 pm
Reply with quote

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
View user's profile Send private message
trilokdewangan

New User


Joined: 19 Jun 2008
Posts: 39
Location: USA

PostPosted: Wed Dec 03, 2008 4:50 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Dec 03, 2008 4:59 pm
Reply with quote

In my shop, the following code works:
Code:
/* REXX */                               
ADDRESS ISPEXEC "VGET (DSNEOV01) PROFILE"
SAY DSNEOV01                             
EXIT                                     


O.
Back to top
View user's profile Send private message
trilokdewangan

New User


Joined: 19 Jun 2008
Posts: 39
Location: USA

PostPosted: Wed Dec 03, 2008 5:33 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Dec 03, 2008 5:38 pm
Reply with quote

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
View user's profile Send private message
trilokdewangan

New User


Joined: 19 Jun 2008
Posts: 39
Location: USA

PostPosted: Wed Dec 03, 2008 7:21 pm
Reply with quote

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
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Wed Jun 03, 2009 11:42 am
Reply with quote

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 icon_smile.gif.
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 isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top