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

Getting Error while connecting to DB2 using through REXX


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

New User


Joined: 21 May 2010
Posts: 8
Location: Hyderabad

PostPosted: Mon Dec 20, 2010 3:50 pm
Reply with quote

Hi All,

i am trying to connect to DB2 through REXX , getting below error.
/***** Rexx */
000221 /*SIGNAL ON SYNTAX */
000223 'SUBCOM DSNREXX'
000225 IF RC <> 0 THEN DO S_RC = RXSUBCOM(ADD,'DSNREXX','DSNREXX')
000227 END
000229 ADDRESS DSNREXX "CONNECT D9AT"

i have n't complete wrote the program,just trying to check whether i am able to connect to DB2 or not.but,getting following error icon_sad.gif icon_sad.gif.please help me asap.
Error :
5 +++ S_RC = RXSUBCOM(ADD,'DSNREXX','DSNREXX')
Error running SAMPLE, line 5: Routine not found
***
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Mon Dec 20, 2010 4:14 pm
Reply with quote

In my working code, I have :
Code:
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
ADDRESS DSNREXX "CONNECT" "D9AT"


See the quotes around the ADD and separation of the CONNECT and D9AT ....

Garry.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Mon Dec 20, 2010 5:34 pm
Reply with quote

Look at this thread. Your problem sounds the same, which means that your answer will be too.
Back to top
View user's profile Send private message
RaviTejaG

New User


Joined: 21 May 2010
Posts: 8
Location: Hyderabad

PostPosted: Tue Dec 21, 2010 12:40 pm
Reply with quote

Hi Garry/Akatsukami

i modified the code accordingly now i am getting error in the next line i.e., in connect statement ,PFB the code

ADDRESS ISPEXEC "LIBDEF ISPLLIB DATASET ID('D9AT.DB2.DSNLOAD')"
000227 'SUBCOM DSNREXX'
000228 SAY RC
000229 IF RC<>0 THEN
000230 S_RC=RXSUBCOM('ADD' , 'DSNREXX' , 'DSNREXX')
000233 SAY RC
000240 ADDRESS DSNREXX 'CONNECT' D9AT
000250 SAY RC

and the it is showing error RC(-3).
Regards,
RaviTejaG
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Tue Dec 21, 2010 2:39 pm
Reply with quote

I also had the D9AT in quotes - i.e 'D9AT'

Garry.
Back to top
View user's profile Send private message
RaviTejaG

New User


Joined: 21 May 2010
Posts: 8
Location: Hyderabad

PostPosted: Tue Dec 21, 2010 3:57 pm
Reply with quote

Hi Garry,
Did the same, got the same error again icon_confused.gif
ADDRESS ISPEXEC "LIBDEF ISPLLIB DATASET ID('D9AT.DB2.DSNLOAD')"
000227 'SUBCOM DSNREXX'
000228 SAY RC
000229 IF RC<>0 THEN
000230 S_RC=RXSUBCOM('ADD' , 'DSNREXX' , 'DSNREXX')
000233 SAY S_RC
000240 ADDRESS DSNREXX "CONNECT" "D9AT"
000250 SAY RC

Regards,
RaviTeja.G
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Dec 21, 2010 4:01 pm
Reply with quote

How about sequence numbers starting in col 1?
Back to top
View user's profile Send private message
RaviTejaG

New User


Joined: 21 May 2010
Posts: 8
Location: Hyderabad

PostPosted: Tue Dec 21, 2010 4:11 pm
Reply with quote

No sequence number is not starting from clo1 , while copying sequence number also copied.
Regards,
RaviTeja.G
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Dec 21, 2010 4:27 pm
Reply with quote

Well, remove the sequence number from any column.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Tue Dec 21, 2010 4:33 pm
Reply with quote

The numbers to the left can confuse. REXX counts line from start - try NUM OFF.

Is 'D9AT.DB2.DSNLOAD' the DB2 loadlib with DSNREXX? Not .SDSNLOAD by any chance?

Garry.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Dec 21, 2010 4:35 pm
Reply with quote

Garry, NUM OFF doesnt remove existing sequence numbers.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Tue Dec 21, 2010 4:46 pm
Reply with quote

Peter,
Code:
/***** Rexx */
000221 /*SIGNAL ON SYNTAX */
000223 'SUBCOM DSNREXX'
000225 IF RC <> 0 THEN DO S_RC = RXSUBCOM(ADD,'DSNREXX','DSNREXX')
000227 END
000229 ADDRESS DSNREXX "CONNECT D9AT"

i have n't complete wrote the program,just trying to check whether i am able to connect to DB2 or not.but,getting following error  .please help me asap.
Error :
5 +++ S_RC = RXSUBCOM(ADD,'DSNREXX','DSNREXX')
Error running SAMPLE, line 5: Routine not found


In this, the numbers to the left differ from what REXX reports for the error. NUM OFF (at least where I have worked) resets these to numbered from 1 by increment of 1 which makes it easier to relate to where REXX reports the error.

Garry.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Dec 21, 2010 4:53 pm
Reply with quote

Hi Garry,

in your working code i didnt see any sequence number. In the TS code i do. Beside first the TS is getting a routine not found error and now he is getting a RC(-3). For me that hints to using sequence numbers, especially when he is using a VB format rexx library. But that is a wild gues.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Tue Dec 21, 2010 5:03 pm
Reply with quote

RaviTejaG wrote:
Hi Garry/Akatsukami

i modified the code accordingly now i am getting error in the next line i.e., in connect statement ,PFB the code

ADDRESS ISPEXEC "LIBDEF ISPLLIB DATASET ID('D9AT.DB2.DSNLOAD')"
000227 'SUBCOM DSNREXX'
000228 SAY RC
000229 IF RC<>0 THEN
000230 S_RC=RXSUBCOM('ADD' , 'DSNREXX' , 'DSNREXX')
000233 SAY RC
000240 ADDRESS DSNREXX 'CONNECT' D9AT
000250 SAY RC

and the it is showing error RC(-3).
Regards,
RaviTejaG

OK, it seems that you didn't comprehend --or perhaps even bother to read -- the thread that I referred you to.

RXSUBCOM adds an entry to the TSO command environment table. You are attempting to add a reference to the routine DSNREXX, with the name DSNREXX (they needn't be the same).

ADDRESS directs a command (or all subsequent commands) to a given environment...which of course it locates by checking the environment table. An RC of -3 from ADDRESS means only one thing; that the environment routine is not found.

Check the return code from RXSUBCOM (note that you are assigning it to S_RC, not RC). Check that DSNREXX is really in the linklist or an allocated library.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Tue Dec 21, 2010 5:12 pm
Reply with quote

Try this to see if you can connect
Code:
ARG DB2SUB .                                               
DB2SUBSYS = WORD(TRANSLATE(DB2SUB,' ','='),2)             
IF DB2SUBSYS = ''                                         
   THEN EXIT (12)                                         
                                                           
"SUBCOM DSNREXX"                                           
IF RC THEN                                                 
  S_RC = RXSUBCOM("ADD","DSNREXX","DSNREXX")               
                                                           
ADDRESS DSNREXX "CONNECT" DB2SUBSYS                       
IF SQLCODE <> 0 THEN                                       
  DO                                                       
    SAY "DB2 SUBSYSTEM "DB2SUBSYS" UNAVAILABLE RC" SQLCODE
    EXIT                                                   
  END 
Back to top
View user's profile Send private message
RaviTejaG

New User


Joined: 21 May 2010
Posts: 8
Location: Hyderabad

PostPosted: Tue Dec 21, 2010 8:17 pm
Reply with quote

Hi Akatsukami,
one of your point is correct "OK, it seems that you didn't comprehend ".

i had searched for DSNREXX and found in "D9AT.DB2.DSNLOAD" and "D9AT.DB2.DSNLOAD" pdss.and try to give in linklist
ADDRESS ISPEXEC "LIBDEF ISPLLIB DATASET ID('D9AT.DB2.ADSNLOAD')"

but getting same error "Routine Not found"
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Tue Dec 21, 2010 8:49 pm
Reply with quote

RaviTejaG wrote:
Hi Akatsukami,
one of your point is correct "OK, it seems that you didn't comprehend ".

I will assume that "ADSNLOAD" is a mere typo on your part, as you have never referred to it before.

Now, you have not yet checked the return code from RXSUBCOM, or at least not reported it is this thread. Change the "SAY RC" in the line numbered 233 to "SAY S_RC". RC still contains the return code from SUBCOM, which you have already displayed and which is worthless for debugging.
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 Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts Help on IMS -API URL migrating from P... IMS DB/DC 1
Search our Forums:

Back to Top