Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to get SSID in rexx code

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to get SSID in rexx code
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: 8593
Location: Back in jolly old England

PostPosted: Wed Dec 03, 2008 4:21 pm    Post subject:
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    Post subject:
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: 2360
Location: Israel

PostPosted: Wed Dec 03, 2008 4:59 pm    Post subject:
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    Post subject:
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: 2360
Location: Israel

PostPosted: Wed Dec 03, 2008 5:38 pm    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us