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
 

 

REXX DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
kiranvenkat

New User


Joined: 18 Apr 2013
Posts: 2
Location: india

PostPosted: Tue Apr 23, 2013 12:55 pm    Post subject: REXX DB2
Reply with quote

Hi ,

I'm trying to Execute a querry under my REXX due to which i'm facing an error
Code:
/* REXX */                                                 
  ADDRESS TSO "SUBCOM DSNREXX"                             
    IF RC =1 THEN                                         
    S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')             
    ADDRESS DSNREXX "CONNECT" DBF1                         
    IF SQLCODE ^= 0 THEN CALL SQLCA                       
                                                           
    ADDRESS DSNREXX "EXECSQL :SQLSTMT1"                   
    IF SQLCODE ^= 0 THEN CALL SQLCA                       
   SQLCA:                                                 
        SAY "SQLCODE  = " SQLCODE                         
        EXIT                                               
        ADDRESS DSNREXX  DISCONNECT                       
        S_RC = RXSUBCOM( 'ADD','DSNREXX','DSNREXX')       
        EXIT


Code:

     2 +++ ?                                                         
IRX0013I Error running REXDB2, line 2: Invalid character in program   
***         

Could you please suggest us in handling this error.

De-Colo[u]r'ed and Code'd
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Apr 23, 2013 1:03 pm    Post subject: Reply to: REXX DB2
Reply with quote

since the program is very short
reTYPE it overfrom scratch ... TYPE it, do not CUT AND PASTE, nor COPY

invalid chars are most often a cut and paste consequence

or before that type FIND P'.' to check for non display chars
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1749
Location: UK

PostPosted: Tue Apr 23, 2013 1:33 pm    Post subject:
Reply with quote

And cut and paste your trace
Back to top
View user's profile Send private message
kiranvenkat

New User


Joined: 18 Apr 2013
Posts: 2
Location: india

PostPosted: Tue Apr 23, 2013 3:39 pm    Post subject:
Reply with quote

Hi Enrico,

Connection is getting established now. SQL return code 0 but the D_ID column value is not getting loaded into the local variable DNUMBR.


Code:

ADDRESS TSO "SUBCOM DSNREXX"                               
IF RC <> 0 THEN                                           
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')                 
ADDRESS DSNREXX "CONNECT" DBF1                             
SQLSTMT1 = "SELECT * FROM DPFCBTE.TOOLS",                 
            "WHERE D_ID='XXXXXXXX'"                         
  ADDRESS DSNREXX                                         
  "EXECSQL DECLARE C1 CURSOR FOR S1"                       
  "EXECSQL PREPARE S1 FROM :SQLSTMT1"                     
  "EXECSQL DESCRIBES S1 INTO :DNUMBR"                     
  "EXECSQL OPEN C1"                                       
  "EXECSQL FETCH C1 USING DESCRIPTOR :DNUMBR"             
  SAY DNUMBR                                               
  ADDRESS DSNREXX                                         
  "EXECSQL CLOSE C1"                                       
  "EXECSQL COMMIT"                                         
  "DISCONNECT"                                                                       
EXIT 


Output :
DNUMBR
***
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Apr 23, 2013 4:27 pm    Post subject:
Reply with quote

Perhaps replacing your code from the starting point shown may help you see what the problem is

Note how the descriptor is used in this code

And please do learn how to use the code tags
Code:
ADDRESS DSNREXX                                               
SQRUN=0
"EXECSQL DECLARE C1 CURSOR FOR S1"                             
IF SQLCODE <> 0 THEN CALL SQLCA                               
"EXECSQL PREPARE S1 INTO :RETURN FROM :SQLSTMT"               
IF SQLCODE <> 0 THEN CALL SQLCA                               
"EXECSQL OPEN C1 "                                             
DO UNTIL (SQLCODE <> 0)                                       
    "EXECSQL FETCH C1 USING DESCRIPTOR :RETURN "               
IF ( SQLCODE = 0 ) THEN                                       
 DO                                                           
        IF SQRUN = 0 THEN DO                                   
          SAY "# VARIABLES =" RETURN.SQLD                     
          DO AZ = 1 TO RETURN.SQLD                             
            SAY "VARIABLE "RIGHT(AZ,3)" =" RETURN.AZ.SQLNAME   
          END                                                 
          SQRUN = 9                                           
        END                                                   
    END                                                       
  END                                                         
ADDRESS DSNREXX "EXECSQL CLOSE C1" 
EXIT
SQLCA:                                         
 SAY "SQLSTATE  =>>" SQLSTATE                 
 SAY "SQLERRP   =>>" SQLERRP                   
 SAY "SQLERRMC  =>>" SQLERRMC                 
 SAY "SQLCODE   =>>" SQLCODE                   
 SAY "SQLWARN.0 =>>" SQLWARN.0",",             
                 ||  SQLWARN.1",",             
                 ||  SQLWARN.2",",             
                 ||  SQLWARN.3",",             
                 ||  SQLWARN.4",",             
                 ||  SQLWARN.5",",             
                 ||  SQLWARN.6",",             
                 ||  SQLWARN.7",",             
                 ||  SQLWARN.8",",             
                 ||  SQLWARN.9",",             
                 ||  SQLWARN.10               
 SAY "*************"                           
 SAY "SQLERRD.1 =>>" SQLERRD.1",",     
                 ||  SQLERRD.2",",     
                 ||  SQLERRD.3",",     
                 ||  SQLERRD.4",",     
                 ||  SQLERRD.5",",     
                 ||  SQLERRD.6         
 SAY "*************"                   
 EXIT (16)                             
   
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Tue Apr 23, 2013 4:32 pm    Post subject: Reply to: REXX DB2
Reply with quote

I strongly suggest to all the users of the REXX/DB2 interface to look at

http://www.ibmmainframes.com/viewtopic.php?t=59952&highlight=idug

and USE it ..., makes rexx/db2 handling much more easy
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts REXX compiled via RXTCOMP sergeyken CLIST & REXX 7 Tue Feb 07, 2017 9:41 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


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