|
View previous topic :: View next topic
|
| Author |
Message |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Hi All,
I am trying to connect to DB2 from REXX. Please guide me on this.
Below is the code i tried
| Code: |
/*REXX*/
trace i
ssid='VFST'
ADDRESS ISPEXEC
"LIBDEF ISPLLIB DATASET ID('VFST.DB2.SDSNLOAD' 'VFST.DB2.SDSNEXIT')"
say RC
ADDRESS TSO "SUBCOM DSNREXX"
say RC
IF RC = 1 THEN DO
s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')"
END
ADDRESS DSNREXX "CONNECT "ssid
say RC
exit
|
I issued ISRDDN but could not find 'VFST.DB2.SDSNLOAD' so used "LIBDEF ISPLLIB ".
Below is from TRACE
| Code: |
3 *-* ssid='VFST'
>L> "VFST"
4 *-* ADDRESS ISPEXEC
5 *-* "LIBDEF ISPLLIB DATASET ID('VFST.DB2.SDSNLOAD' 'VFST.DB2.SDSNEXIT')"
>L> "LIBDEF ISPLLIB DATASET ID('VFST.DB2.SDSNLOAD' 'VFST.DB2.SDSNEXIT'
)"
6 *-* say RC
>V> "0"
0
8 *-* ADDRESS TSO "SUBCOM DSNREXX"
>L> "SUBCOM DSNREXX"
+++ RC(1) +++
9 *-* say RC
>V> "1"
1
11 *-* IF RC = 1
>V> "1"
>L> "1"
>O> "1"
*-* THEN
*-* DO
12 *-* s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')"
>L> "RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')"
13 *-* /**/
14 *-* /**/
15 *-* end
17 *-* ADDRESS DSNREXX "CONNECT "ssid
>L> "CONNECT "
>V> "VFST"
>O> "CONNECT VFST"
+++ RC(-3) +++
18 *-* say RC
>V> "-3"
-3
20 *-* exit
|
I also tested without using " but its throwing error message like " Incorrect call to routine "
| Code: |
s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')
|
TRACE I
| Code: |
12 *-* s_rc= RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')
>L> "ADD"
>L> "DSNREXX"
>L> "DSNREXX"
>L> "VFST.DB2.SDSNLOAD"
12 +++ s_rc= RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')
IRX0040I Error running DESC1, line 12: Incorrect call to routine
|
Tried this as well, removed DSNLOAD from the RXSUBCOM.
| Code: |
s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX')"
|
TRACE I throws,
| Code: |
12 *-* s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX')"
>L> "RXSUBCOM('ADD','DSNREXX','DSNREXX')"
13 *-* /**/
14 *-* /**/
15 *-* end
17 *-* ADDRESS DSNREXX "CONNECT "ssid
>L> "CONNECT "
>V> "VFST"
>O> "CONNECT VFST"
+++ RC(-3) +++
18 *-* say RC
>V> "-3"
-3
20 *-* exit
|
|
|
| Back to top |
|
 |
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
Have you tried (watch the quotes!):
| Code: |
| S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') |
|
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
|
|
| Quote: |
| LIBDEF ISPLLIB DATASET ID('VFST.DB2.SDSNLOAD' 'VFST.DB2.SDSNEXIT')" |
see
ibmmainframes.com/viewtopic.php?t=53382&highlight=ispf+tso+search+order
for a discussion of library search order and why TSO will not resolve a load from a LBDEFfed loibrary
RXSUBCOM in DSNxxx.sdsnload is an alias of DSNREXX so the retry is just useless
if You cannot find DSNREXX it is unlikely that You will find RXSUBCOM
speak to Your support in order to have the proper libraries in the tso logon procedures |
|
| Back to top |
|
 |
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
Enrico, I agree with you about the LIBDEF, but so far the TS has not tried the correct syntax for RXSUBCOM. In a couple of cases he supplied too many parameters (which generated the "Incorrect call..." message) and in the others the quotes were incorrect.
I don't know if fixing the quotes will correct the problem, but it is the next logical thing to try.
BTW I'd like to compliment the TS for attempting to solve the problem on his own, and showing us what he tried. A refreshing change. |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
I've seen similar code posted to this forum that was presumably also "borrowed" without understanding from a common source.
Lose the call to SUBCOM; this function is pretty much worthless. Check your return codes, and note that the return code from RXSUBCOM is s_rc, not rc. |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Thanks a lot all..
Don.leahy,
i tried the same code but did not work.
| Code: |
s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX')
|
TRACE
| Code: |
12 *-* s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX')
>L> "ADD"
>L> "DSNREXX"
>L> "DSNREXX"
IRX0250E System abend code 806, reason code 00000004.
IRX0253E Abend in external function RXSUBCOM.
12 +++ s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX')
IRX0040I Error running DESC1, line 12: Incorrect call to routine
|
Akatsukami,
Yes, i borrowed this code but from REDBOOK, not from forum.
I used s_rc for RXSUBCOM but SAYing RC for SUBCOM & CONNECT.
Please suggest what needs to be fixed.
Enrico,
you are correct, i have seen this.
After ADDRESS ISPEXEC "LIBDEF ISPLLIB, i can see
| Code: |
DDname Data Set Name Actio
ISP00383 SYS1.DSND00A.SDSNLOAD
SYS1.DSNVFST.SDSNEXIT
and
SYS1.DSND00A.SDSNLOAD
=>
Name Prompt Lib Alias-of
RXSUBCOM 1 DSNREXX
|
I would like to try everything rather than hearing a big No from them.
Let me try with Support people.
Thanks,
Dev |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Hi Enrico,
I went to SDSF and then my user id ( G1xxx1T). I found
| Code: |
XXSYSPROC DD DSN=xxx.ISPF.xxxx.CMDPROC,DISP=SHR
|
then i found one member DB2CVFST ( out of 524 members) in the SYSPROC and this is a CLIST and it contains
| Code: |
PROC 0 ALOCOPT()
SET &CONCAT_LIBS = &STR(+
ISPLLIB ('''VFST.DB2.SDSNEXIT'' +
''VFST.DB2.SDSNLOAD''')
%DB2CALOC ALOCOPT (&ALOCOPT.) &CONCAT_LIBS
|
Do the contents of the member DB2CVFST of SYSPROC get executed when i log on and the above DB2 load libs get allocated to my TSO session?
Am I following what you suggested? Please guide me on this.
Thanks,
Dev |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
|
|
no You are not following what I am suggesting You
I had already told You to ...
| Quote: |
speak to Your support in order to have the proper libraries in the tso logon procedures
|
all the other similar topics whit the same issue on dsnrexx were solved with the help of the in house support group
don' You think we have spent enough time on Your issue
since DB2CVFST and DB2CALOC are not standard procedures how in heaven are we supposed to know how/when/why/forwhat they should be/are used |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Actuallly i spoke to support group but seems the person is not able to answer. I am waiting for another team who may like to answer me.
So instead of waiting i was trying from my side... :-)
Thank you. |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| devmisra wrote: |
Akatsukami,
Yes, i borrowed this code but from REDBOOK, not from forum.
|
As, presumably, did the previous querents...none of whom actually understood what they were doing.
| Quote: |
I used s_rc for RXSUBCOM but SAYing RC for SUBCOM & CONNECT.
Please suggest what needs to be fixed.
|
Very well. I don’t have the time that I ordinarily would this morning, but we will see how far we can get.
| Code: |
| ADDRESS TSO "SUBCOM DSNREXX" |
I said before that this was a worthless thing to do. I still do. Why do I say that?
TSO maintains an environment table; Rexx is not the only user of this table, although it is probably the best and most widely known. Each row in the table has three columns: name, routine, and token. name is the name of the environment, and can be anything that would be valid as a PDS member name. routine is the name of the load module that handles commands sent to the name environment; it must be in the LPA or the linklist, but need not be the same as name. token is a 16-byte field that is passed to routine on every invocation.
What does “SUBCOM name” do? It checks for the existence of a name row in the environment table…but does not validate that row! It is possible (in principle; I definitely recommend that you not try this) to add a row to the table, delete the routine, invoke SUBCOM against the name, and still get RC=0 from SUBCOM.
If you are genuinely concerned over the possibility of a bogus row for your environment in the table, I suggest that you code something like this:
| Code: |
“SUBCOM FOO”
if (rc=0) then /* There is a row named FOO */
rc = RXSUBCOM(“DELETE”,”FOO”,”FOOHNDLR”) /* Get rid of it */
rc = RXSUBCOM(“ADD”,”FOO”,”FOOHNDLR”)
if (rc¬=0) then do /* The call to RXSUBCOM failed */
/* Error handling here */
end
|
And I see that I’m out of time for now. I’ll get back to the other problems with this code later. |
|
| Back to top |
|
 |
yuvrajdutta
New User

Joined: 13 Jul 2009 Posts: 40 Location: India
|
|
|
|
I have worked on REXX and DB2 a BIT.. and have the below code to offer:
| Code: |
/* REXX */
/*FIXED LIST SELECT WITH PARAMETER MARKERS*/
EMP_ID="'051029'"
ADDRESS TSO
'SUBCOM DSNREXX'
IF RC = 1 THEN DO
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
END
ADDRESS DSNREXX
"CONNECT DB2R"
QRY="SELECT FIRST_NAME,MIDDLE_NAME,LAST_NAME" ,
"FROM IBMGRP.EMP" ,
"WHERE EMP_ID = CAST ( ? AS CHAR(6) )"
'EXECSQL DECLARE C1 CURSOR FOR S1'
IF SQLCODE /= 0 THEN CALL SQLCA
'EXECSQL PREPARE S1 FROM :QRY'
IF SQLCODE /= 0 THEN CALL SQLCA
"EXECSQL OPEN C1 USING :EMP_ID"
IF SQLCODE /= 0 THEN CALL SQLCA
DO UNTIL(SQLCODE /= 0)
"EXECSQL FETCH C1 INTO :FIRST_NAME, :MIDDLE_NAME :MIND, :LAST_NAME"
IF SQLCODE /= 0 THEN
CALL SQLCA
ELSE
DO
SAY 'FIRST NAME: ' FIRST_NAME
IF MIND == 0 THEN
SAY 'MIDDLE NAME: ' MIDDLE_NAME
ELSE
SAY 'NULL VALUE RECEIVED'
SAY 'LAST NAME: ' LAST_NAME
SAY
END
END
"EXECSQL CLOSE C1"
IF SQLCODE /= 0 THEN CALL SQLCA
"DISCONNECT"
IF SQLCODE /= 0 THEN CALL SQLCA
S_RC = RXSUBCOM('DELETE','DSNREXX','DSNREXX')
SQLCA:
SAY "SQLCODE = " SQLCODE
SAY "SQLERRMC = " SQLERRMC
SAY "SQLERRP = " SQLERRP
SAY "SQLERRD.1= " SQLERRD.1
SAY "SQLERRD.2= " SQLERRD.2
SAY "SQLERRD.3= " SQLERRD.3
SAY "SQLERRD.4= " SQLERRD.4
SAY "SQLERRD.5= " SQLERRD.5
SAY "SQLERRD.6= " SQLERRD.6
SAY "SQLWARN.0= " SQLWARN.0
SAY "SQLWARN.1= " SQLWARN.1
SAY "SQLWARN.2= " SQLWARN.2
SAY "SQLWARN.3= " SQLWARN.3
SAY "SQLWARN.4= " SQLWARN.4
SAY "SQLWARN.5= " SQLWARN.5
SAY "SQLWARN.6= " SQLWARN.6
SAY "SQLWARN.7= " SQLWARN.7
SAY "SQLWARN.8= " SQLWARN.8
SAY "SQLWARN.9= " SQLWARN.9
SAY "SQLWARN.10= " SQLWARN.10
SAY "SQLSTATE = " SQLSTATE
EXIT
|
In REXX all SQL is DYNAMIC NO MATTER WHAT..
this one is the simpler form of select as such.. but if you need I have examples of all the 3 variations(NON-SELECT/FIXED-LIST SELECT/VARYING-LIST SELECT) w/o parameter markers (6 in all) and I can share |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Thank you Yuvraj for the code but i am stuck at the connection only.
There is some libraries issues... |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
(Note that Yuvraj copied the first few lines of his code from the same source as did Dev Misra and the other querents, and therefore it has the same weaknesses.)
Now, concerning the line:
| Code: |
| s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX','VFST.DB2.SDSNLOAD')" |
where you fail to add a row to the environment table named DSNREXX for the command processor DSNREXX (the two names need not be the same).
Mr. Leahy is correct that the proper syntax is:
| Code: |
| s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX') |
There's something more than RXSUBCOM/DSNREXX not being in STEPLIB, the LPA, or the linklist; not finding it ought not to give you a S806-04 abend in TSO. I would check the RXSUBCOM alias directory entry's attributes against those of the DSNREXX directory entry's, and also ensure that RXSUBCOM doesn't appear twice in the library list.
When you've gotten that problem resolved, note that this still won't ensure a return code of zero from RXSUBCOM; you must check it. And, everyone who copies that code snippet from the manual (DB2 UDB V8, I think) seems incapable of understanding that the return code from RXSUBCOM is in variable s_rc, not rc. So I don't really give a reservoir if you display rc a lakh of times at this point; show me s_rc and we'll talk.
(rc ought to be considered, of course, when it is meaningful; e.g., after your ADDRESS statement. But that's another post.) |
|
| Back to top |
|
 |
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
| devmisra wrote: |
Thanks a lot all..
Don.leahy,
i tried the same code but did not work.
| Code: |
s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX')
|
TRACE
| Code: |
12 *-* s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX')
>L> "ADD"
>L> "DSNREXX"
>L> "DSNREXX"
IRX0250E System abend code 806, reason code 00000004.
IRX0253E Abend in external function RXSUBCOM.
12 +++ s_rc=RXSUBCOM('ADD','DSNREXX','DSNREXX')
IRX0040I Error running DESC1, line 12: Incorrect call to routine
|
|
In our shop RXSUBCOM (alias of DSNREXX) is loaded from the ISPLLIB. (I know this because I FREE'd my ISPLLIB and received S806 when I tried to run RXSUBCOM). Do you see RXSUBCOM in your ISPLLIB?
Is anyone else using DSNREXX in your shop? Not every shop has bothered to activate it. |
|
| Back to top |
|
 |
yuvrajdutta
New User

Joined: 13 Jul 2009 Posts: 40 Location: India
|
|
|
|
If it aint activated.. try out
| Code: |
| <DB2HLQ>.SDSNSAMP(DSNTIJRX) |
| Code: |
| DSN810.SDSNSAMP(DSNTIJRX) |
@ my end)..
someone with Admin access to your DB should be running this job. |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| yuvrajdutta wrote: |
| someone with Admin access to your DB should be running this job. |
I find it odd that you should say this, as there is in fact no data base referenced in the code. Do you have a reason for thinking as you do? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
Akatsukami,
your subtlety is inspiring as well as educational.
much better than being confrontational. |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Akatsukami,
Thank you so much for this explanation. crystal clear ..
here s_rc is behaving like a variable, Below is a trace output
| Code: |
18 *-* s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX')"
19 *-* say s_rc
RXSUBCOM('ADD','DSNREXX','DSNREXX')
|
don.leahy,
I checked the ISPLLIB(from ISRDDN) but did not find RXSUBCOM. but found in VFST.DB2.SDSNLOAD and this library used in STEPLIB in VFSTMSTR. i.e VFST.DB2.SDSNLOAD is not activated as ISPLLIB.
Enrico,
Please be cool... .. I contacted the support people but they were not able to answer. |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| dbzTHEdinosauer wrote: |
Akatsukami,
your subtlety is inspiring as well as educational.
much better than being confrontational. |
I try...sometimes; my bad leg is giving me very little trouble at the moment, so I'm in a much better mood than if I were experiencing pain at every step.
Dev Misra, your first problem (and there could be many other problems concealed by this one) is obvious. Your code and trace snippet make it clear that in the line
| Code: |
| s_rc="RXSUBCOM('ADD','DSNREXX','DSNREXX')" |
you have defined a string (enclosed in double quotes), which you then assign to s_rc. As Don Leahy suggested Thursday, drop the double quotes.
| devmisra wrote: |
Enrico,
Please be cool... .. I contacted the support people but they were not able to answer. |
Probably and unfortunately true; the querents on these and similar fora show that the rot is spreading upwards, with unskilled, inexperienced, and incapable people being given the roles of system programmer, DBA, etc. |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Akatsukami,
I also tried w/o quote before but no use.
| Code: |
23 *-* s_rc= RXSUBCOM('ADD','DSNREXX','DSNREXX')
IRX0250E System abend code 806, reason code 00000004.
IRX0253E Abend in external function RXSUBCOM.
23 +++ s_rc= RXSUBCOM('ADD','DSNREXX','DSNREXX')
IRX0040I Error running DESC1, line 23: Incorrect call to routine
|
|
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
OK, that indicates that RXSUBCOM is not in an allocated load library.
I'm a bit uncertain how to proceed here. It would be easy enough to invoke RXSUBCOM, but as you've been told, RXSUBCOM is an alias for DSNREXX, the IBM Rexx/DB2 interface, and there's no way to specify to TSO that it should use a command processor not in STEPLIB/LPA/linklist. I can see a couple of possibilities, but I'll need to do some experimentation when I get into my office, which won't be for a couple of hours yet. |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Thank you Akatsukami..
I also was trying TSOLIB ACTIVATE but its also throwing an error
| Code: |
IDY00046I TSOLIB terminated. A valid TSOLIB environment does not exist.+
IDY00046I The TSOLIB command with the ACTIVATE, DEACTIVATE or RESET operands mu
st be invoked from the TSO/E READY environment.
|
|
|
| Back to top |
|
 |
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
The TSO READY environment (aka the "READY prompt") is what you see when you exit ISPF in order to issue the LOGOFF command. That is where the TSOLIB command needs to be issued.
I mentioned earlier that I pick up RXSUBCOM from ISPLLIB. What I failed to mention is that my ISPLLIB allocation is set up by my logon proc before the ISPF environment is initiated. LIBDEF can be used to add libraries to ISPLLIB, but not every software product can see them.
If you have access to your logon procedure, then ISPLLIB would probably be the easier way to go. If not, then try TSOLIB from the READY prompt. |
|
| Back to top |
|
 |
devmisra
New User
Joined: 29 Jan 2009 Posts: 39 Location: India
|
|
|
|
Thanks Don.leahy,
Yes.. i just TSOLIBd the SDSNLOAD and now i am able to connect to DB2
| Code: |
23 *-* s_rc= RXSUBCOM('ADD','DSNREXX','DSNREXX')
24 *-* say s_rc
0
25 *-* /**/
26 *-* ADDRESS DSNREXX "CONNECT "ssid
>>> "CONNECT VFST"
27 *-* say RC
0
29 *-* exit
|
Well, one question,
Is not any other way to allocate the SDSNLOAD? |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Quote: |
| Is not any other way to allocate the SDSNLOAD? |
Ask your incompetent support people to sort it out for you. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|