View previous topic :: View next topic
|
Author |
Message |
mjadwani2785
New User
Joined: 28 Apr 2009 Posts: 89 Location: Noida , Dublin
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
I do not believe LIBDEF files are searched by rexx processes.
Try using TSOLIB before starting your rexx. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
mjadwani2785
New User
Joined: 28 Apr 2009 Posts: 89 Location: Noida , Dublin
|
|
|
|
But the sdsnload library is APF authorised....I can see it.
It contains RXSUBCOM. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
mjadwani2785
New User
Joined: 28 Apr 2009 Posts: 89 Location: Noida , Dublin
|
|
|
|
thanks Marso ...it also striked to me (to be honest) just at the moment when you were typing this reply I did the same ...
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
mjadwani2785
New User
Joined: 28 Apr 2009 Posts: 89 Location: Noida , Dublin
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
mjadwani2785
New User
Joined: 28 Apr 2009 Posts: 89 Location: Noida , Dublin
|
|
|
|
Thanks I found the problem...now its solved ..SDSNLOAD was not in linklist..TSOLIBd it and it workd..
thanks all |
|
Back to top |
|
|
mjadwani2785
New User
Joined: 28 Apr 2009 Posts: 89 Location: Noida , Dublin
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|