MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

connect subsys error in rexx

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
mainfrae
Beginner


Joined: 17 Feb 2006
Posts: 17
Topics: 9

PostPosted: Mon Nov 26, 2007 8:00 am    Post subject: connect subsys error in rexx Reply with quote

Hi,

I am getting an error RC(-3), when i am trying to execute the below sample program,
Code:

000001 /* REXX */                                                       
000002 /*TRACE ?I*/                                                     
000003 ADDRESS ISPEXEC "CONTROL ERRORS RETURN"                         
000004 ADDRESS ISPEXEC "LIBDEF ISPPLIB DATASET ID('VE0128.TEST.REXX')" 
000005 ADDRESS ISPEXEC "ADDPOP ROW(3) COLUMN(5)"                       
000006 ADDRESS ISPEXEC "DISPLAY PANEL(PNL2)"                           
000007 ADDRESS ISPEXEC "REMPOP"                                         
000008 ADDRESS ISPEXEC "LIBDEF ISPPLIB"                                 
000009 TNAME = STRING                                                   
000010   SUBSYS  = SYST                                                 
000011   TCREATE = CREAT                                               
000012      IF (TNAME = " " | SUBSYS = " " | TCREATE = " ") THEN       
000013         EXIT                                                     
000014      CALL MAIN_PGM                                               
000015                                                                 
000016 MAIN_PGM:                                                       
000017                                                                   
000018   SQLSTMT1  = "SELECT GRANTEE",                                   
000019               "FROM SYSIBM.SYSTABAUTH",                           
000020               "WHERE GRANTEETYPE = 'P'",                           
000021               "AND TCREATOR = '"TCREATE"'",                       
000022               "AND TTNAME = '"TNAME"'",                           
000023               "ORDER BY GRANTEE"                                   
000024  [b]ADDRESS TSO "SUBCOM DSNREXX"[/b]     /* HOST CMD ENV AVAILABLE ? */   
000025     IF RC THEN S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')         
000026     [b]ADDRESS DSNREXX "CONNECT" SUBSYS[/b]

I will get the input through the panel, and lets consider my subsys is DB2T, when i try to trace it out, it gets failed in ADDRESS DSNREXX "CONNECT" SUBSYS giving RC(-3)..but ADDRESS TSO "SUBCOM DSNREXX" gives me 0...that means the host command environment is avaible...could any one give me some idea to solve this issue...
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Mon Nov 26, 2007 8:13 am    Post subject: Reply with quote

mainfrae,

Check the SQLCODE instead of the RC.

Check this link which discusses problem with connect:

http://www.mvsforums.com/helpboards/viewtopic.php?t=5546&highlight=address+dsnrexx
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Nov 26, 2007 12:08 pm    Post subject: Reply with quote

If your susbsystem is 'DB2T' why are you setting the variable SUBSYS to SYST? Is SYST a variable from your panel? And does it have the correct value when back in the exec?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
mainfrae
Beginner


Joined: 17 Feb 2006
Posts: 17
Topics: 9

PostPosted: Mon Nov 26, 2007 11:08 pm    Post subject: Reply with quote

Ya,SYST is a variable from my panel. Ya, It have the correct value when back in the exec
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Nov 27, 2007 2:14 pm    Post subject: Reply with quote

You are not testing for the RC from RXSUBCOM:
Code:

   s_rc = RXSUBCOM('ADD','DSNREXX','DSNREXX');                                 
   If s_rc <> 0,                                                               
   Then Do;                                                                     
                                                                               
      zedsmsg = 'RXSUBCOM rc = 's_rc                                           
      zedlmsg = 'RXSUBCOM failed to add the DSNREXX environment'               
      Address ISPEXEC 'SETMSG MSG(ISRZ001)';                                   
      Exit /* exit directly */                                                 
                                                                               
   End;                                                                         

_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
mainfrae
Beginner


Joined: 17 Feb 2006
Posts: 17
Topics: 9

PostPosted: Wed Nov 28, 2007 8:12 am    Post subject: Reply with quote

Hi

When i checked the program by using the 'trace' command as shown below

>O> "SELECT GRANTEE FROM SYSIBM.SYSTABAUTH WHERE GRANTEETYPE = 'P' AN
D TCREATOR = 'HUND7' AND TTNAME = 'EMPLOYEE' ORDER BY GRANTEE"

28 *-* ADDRESS TSO "SUBCOM DSNREXX" /* HOST CMD ENV AVAILABLE ? */
>L> "SUBCOM DSNREXX"

29 *-* IF RC <> 0
>V> "0"
>L> "0"
>O> "0"

39 *-* ADDRESS DSNREXX "CONNECT" SUBSYS
>L> "CONNECT"
>V> "DB2T"
>O> "CONNECT DB2T"
+++ RC(-3) +++
I am getting the error when connecting to subsys not during using "SUBCOM DSNREXX" .Please help me out of this...
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Nov 28, 2007 8:23 am    Post subject: Reply with quote

mainfrae,

Try to display the SQLCODE after the connect statement.

Insert the below line after the connect:

SAY 'SQLCODE: ' SQLCODE

and let us know the sqlcode.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
mainfrae
Beginner


Joined: 17 Feb 2006
Posts: 17
Topics: 9

PostPosted: Wed Nov 28, 2007 8:49 am    Post subject: Reply with quote

I tried to print the SQLCODE, but it went in vein, its not displaying any SQLCODE, because i think if it is not connecting to the DB2 then how it will print the sqlcode...Its my gues., sorry if its wrong...
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Wed Nov 28, 2007 9:58 am    Post subject: Reply with quote

mainfrae,

Quote:

because i think if it is not connecting to the DB2 then how it will print the sqlcode...Its my gues., sorry if its wrong...


Well.. I dont think so.. For the following code:

Code:

ADDRESS 'DSNREXX'       
SYST = 'DB2T'           
"CONNECT " SYST         
SAY 'RC: ' RC           
SAY 'SQLCODE: ' SQLCODE


It displayed

RC: 0
SQLCODE: 0

And when I changed SYST as ASDF

It displayed

RC: -1
SQLCODE: -924

I guess the problem in your case is with the ADDRESS 'DSNREXX' statement.

You have code as ADDRESS DSNREXX. It should have been ADDRESS 'DSNREXX'

You have not enclosed DSNREXX in single quotes.

Change it and try running it.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Nov 28, 2007 1:07 pm    Post subject: Reply with quote

No -
Code:

ADDRESS DSNREXX

is fine - I use it that way - you do not have to put the command processor (DSNREXX in this case) in quotes.

Silly question - are you sure that DB2T is the name of a valid DB2 subsystem in your shop?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Nov 28, 2007 1:14 pm    Post subject: Reply with quote

just another thing- a -3 says the first token after DSNREXX is invalid - are you 100% sure that there is a blank between "CONNECT" and SYST? Just to be sure put one INSIDE the quotes.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
mainfrae
Beginner


Joined: 17 Feb 2006
Posts: 17
Topics: 9

PostPosted: Thu Nov 29, 2007 12:37 am    Post subject: Reply with quote

vivek,

I am getting the output like below for my program..
RC: -3
SQLCODE: SQLCODE

Clouston,

DB2T is a valid subsystem and i checked the ADDRESS DSNREXX "CONNECT" SUBSYS and it is correct...


Mainfrae
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Nov 29, 2007 2:50 pm    Post subject: Reply with quote

don't do a 'Call main_pgm' - the code will drop through to it. Or put an 'EXIT' between the CALL and the label:.

Have you run a trace?

What you show should result in main_pgm being excuted twice and CONNECT may not like that.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Jan 08, 2008 5:09 am    Post subject: Reply with quote

Well??? Fixed???
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group