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
 

 

DB2 REXX connectivity RXSUBCOM!!!

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Wed Mar 17, 2010 7:17 pm    Post subject: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

Hi,

I am just trying out a sample code for REXX DB2 connectivity
my code is:

/* rexx */

sql_query='*****' /*some sql query*/

db2_subsys=DB2X /*subsytem_id*/


/* address ispexec
"libdef ispllib dataset id('DNDDB2.DB2X.SDSNLOAD')" */

s_rc = 0

SUBCOM DSNREXX

if rc<>0 then
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')

ADDRESS DSNREXX

"connect" db2_subsys
If rc <> 0 Then Do
Say 'Cannot connect to ' DB2_subsys ' RC=' rc
Exit(23)
End

ADDRESS DSNREXX
"DISCONNECT"
S_Rc = RXSUBCOM('DELETE','DSNREXX','DSNREXX')

now my code is abending at
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') step.
Error says "routine not found".

I tried even to libdef sdsnload but then the error says subcom is not dialogue service.

Need help to sort out this problem?
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Mar 17, 2010 7:43 pm    Post subject: Reply to: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

I do not believe LIBDEF files are searched by rexx processes.

Try using TSOLIB before starting your rexx.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Mar 17, 2010 7:47 pm    Post subject:
Reply with quote

The library containing DSNREXX is not in an allocated library or the linklist. Allocate the library, or ask your support for help.
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Wed Mar 17, 2010 7:51 pm    Post subject: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

But the sdsnload library is APF authorised....I can see it.
It contains RXSUBCOM.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Mar 17, 2010 7:57 pm    Post subject:
Reply with quote

Quote:
But the sdsnload library is APF authorised....I can see it.
It contains RXSUBCOM.
Not necessarily. If any single library in a concatenation is not APF-authorized, then all of the libraries lose APF authorization. So unless you've verified every library in your concatenation list is authorized, you can say the library itself is authorized but you cannot say your access to it is APF-authorized.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Wed Mar 17, 2010 8:20 pm    Post subject: Re: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

When you code your LIBDEF like this:
mjadwani2785 wrote:
address ispexec
"libdef ispllib dataset id('DNDDB2.DB2X.SDSNLOAD')"

Then you are executing 2 different commands:
1. address ispexec.
2. the LIBDEF statement.
The address statement, when coded alone as you did, will change the default environment to ispf instead of tso
All following external commands (like SUBCOM for example) will be directed to ISPF, that's why you've received:
mjadwani2785 wrote:
the error says subcom is not dialogue service.


I advise you to try again with the libdef, but this time on one line only:
Code:
address ispexec "libdef ispllib dataset id('DNDDB2.DB2X.SDSNLOAD')"
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Wed Mar 17, 2010 8:42 pm    Post subject: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

thanks Marso icon_smile.gif ...it also striked to me (to be honest) just at the moment when you were typing this reply I did the same icon_smile.gif ...

but still the code is in error

now the error shifted to connect statement

trace says

3 *-* sql_query='select prod_no product_name prod_ver',
'from DSNDB2.COMPINFO'
>L> "select prod_no product_name prod_ver"
>L> "from DSNDB2.COMPINFO"
>O> "select prod_no product_name prod_ver from DSNDB2.COMPINFO"
6 *-* db2_subsys='db2x'
>L> "db2x"
9 *-* /* address ispexec
"libdef ispllib dataset id('DNDDB2.DB2X.SDSNLOAD')"
"libdef ispllib dataset id('DNDDB2.DB2X.SDSNexit')" */
13 *-* s_rc = 0
>L> "0"
15 *-* "SUBCOM DSNREXX"
>L> "SUBCOM DSNREXX"
17 *-* if rc<>0
>V> "0"
>L> "0"
>O> "0"
20 *-* ADDRESS DSNREXX
22 *-* "CONNECT" DB2_SUBSYS
>L> "CONNECT"
>V> "db2x"
>O> "CONNECT db2x"
+++ RC(-3) +++
23 *-* If rc <> 0
>V> "-3"
>L> "0"
>O> "1"
*-* Then
*-* Do
24 *-* Say 'Cannot connect to ' DB2_subsys ' RC=' rc
>L> "Cannot connect to "
>V> "db2x"
>O> "Cannot connect to db2x"
>L> " RC="
>O> "Cannot connect to db2x RC="
>V> "-3"
>O> "Cannot connect to db2x RC= -3"
not connect to db2x RC= -3
25 *-* Exit(23)
>L> "23"

what can be the reason where can I check the rc of "connect" ?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Mar 17, 2010 10:22 pm    Post subject: Re: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

mjadwani2785 wrote:
But the sdsnload library is APF authorised....I can see it.
It contains RXSUBCOM.

Who cares? You're trying to use DSNREXX, not RXSUBCOM. Where is that?
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Thu Mar 18, 2010 12:48 pm    Post subject: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

Quote:
Who cares? You're trying to use DSNREXX, not RXSUBCOM. Where is that?


I jst checked DSNREXX is there in sdsnload member.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Mar 18, 2010 4:11 pm    Post subject:
Reply with quote

OK, now we're beginning to get somewhere.

The SUBCOM function checks for the existence of an entry in the TSO command environment table with the given name. It does not check the validity of said entry. Thus, consider the following code fragment:
Code:

CALL RXSUBCOM 'ADD','FOO','BAR'
SUBCOM FOO
ADDRESS FOO
"YADDA YADDA YADDA"

The call to RXSUBCOM will fail (unless there happens to be a module named BAR in a library in the linklist) with RC=20...however, it will nonetheless create an (invalid) entry in the command environment table named FOO. SUBCOM FOO and ADDRESS FOO will both return RC=0 (SUBCOM will find the entry named FOO, but not validate it; ADDRESS won't even bother to check), but the YADDA command will fail with RC=-3 (command processor in table not found).

IIRC, the table entry will remain for the duration of your TSO session; you'll get RC=0 from SUBCOM until you log off and back on again, after which you'll get RC=1.

So:
  • check the return code from RXSUBCOM; if it is non-zero, call it again with DELETE as the first parameter.
  • SUBCOM is pretty worthless; don't bother with it, IMNSHO.
  • ADDRESS will never return a non-zero RC.
  • RC= -3 in attempting to pass a string to a command processor is diagnostic of said processor not being found, no matter how well you think things have gone to that point.
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Thu Mar 18, 2010 4:28 pm    Post subject: DB2 REXX connectivity RXSUBCOM!!!
Reply with quote

Thanks I found the problem...now its solved ..SDSNLOAD was not in linklist..TSOLIBd it and it workd..

thanks all icon_smile.gif
Back to top
View user's profile Send private message
mjadwani2785

New User


Joined: 28 Apr 2009
Posts: 89
Location: Noida , Dublin

PostPosted: Mon Sep 19, 2011 2:42 pm    Post subject: raising the same question again !!
Reply with quote

Hi ,
Following is the code i have written trying to dynamically allocate SDSNLOAD for my session .. I cant find why it is not allowing me to do so. The same task I can do it by TSOLIB .. but I have seen LIBDEF also works but not in my case.
Here is code...

/*rexx */
parse arg db2sid
ds1 ="SYS1.DSN"db2sid".SDSNLOAD"
db2loadlib ="'"ds1"'"
address tso
"alloc fi(trgllib) ds("db2loadlib") shr reuse "
address ispexec
"control errors "
address ispexec
"libdef ispllib library id(trgllib) uncond stack

address tso "SUBCOM DSNREXX"
if rc<>0 then ,
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
address dsnrexx "CONNECT" db2sid
If rc <> 0 Then Do
Say 'Cannot connect to ' DB2_subsys ' RC=' rc
RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
Exit(23)
End
return rc

when it is run it gives me this output (with trace )

9 *-* address tso
10 *-* "alloc fi(trgllib) ds("db2loadlib") shr reuse "
>L> "alloc fi(trgllib) ds("
>V> "'SYS1.DSNDB2V.SDSNLOAD'"
>O> "alloc fi(trgllib) ds('SYS1.DSNDB2V.SDSNLOAD'"
>L> ") shr reuse "
>O> "alloc fi(trgllib) ds('SYS1.DSNDB2V.SDSNLOAD') shr reuse "
11 *-* address ispexec
12 *-* "control errors "
>L> "control errors "
13 *-* address ispexec
14 *-* "libdef ispllib library id(trgllib) uncond stack" /*8"db2loadlib") "
*/
>L> "libdef ispllib library id(trgllib) uncond stack"
16 *-* address tso "SUBCOM DSNREXX"
>L> "SUBCOM DSNREXX"
+++ RC(1) +++
17 *-* if rc<>0
>V> "1"
>L> "0"
>O> "1"
*-* then ,
18 *-* S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
>L> "ADD"
>L> "DSNREXX"
>L> "DSNREXX"
CSV003I REQUESTED MODULE DSNTZANB NOT FOUND
CSV028I ABEND806-04 JOBNAME=D05922E STEPNAME=IKJACCNT
IRX0250E System abend code 806, reason code 00000004.
IRX0253E Abend in external function RXSUBCOM.

What can be the problem. Load module is there in the dataset .

Pedro replied "Libdef doesnot work for rexx process " .. but the other day i have seen libdef working with CLIST ...

what can be the alternative for TSOLIB .. I want to add this load dataset dynamically . Linklist addition of DB2 load lib is not allowed at my site.


Please Help . !!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Sep 19, 2011 8:14 pm    Post subject:
Reply with quote

Hello,

Your library concatenation is still incomplete/incorrect. . .

An 806-04 is always "module not found".

Did you read the information about the 806 in the documentation?
Quote:
04
The system could not find the module, whose entry point is the value of the EP or EPLOC operand, in the indicated library (private library, job library, or link library). This situation can occur when LSEARCH=YES is specified on the macro and the limited library search fails to locate the module. For an alias name, ensure that the entry point attributes match that of the load module which was previously loaded (that is, authorization, RMODE, entry point displacement).
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 What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


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