IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

REXX DB2


 
IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Senior Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

PostPosted: Tue Apr 23, 2013 1:03 pm
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: 2430
Location: Hampshire, UK

PostPosted: Tue Apr 23, 2013 1:33 pm
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
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: 8793
Location: Welsh Wales

PostPosted: Tue Apr 23, 2013 4:27 pm
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

Senior Member


Joined: 14 Mar 2007
Posts: 10695
Location: italy

PostPosted: Tue Apr 23, 2013 4:32 pm
Reply with quote

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

Use [URL] BBCode for Links

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 All times are GMT + 6 Hours
Forum Index -> CLIST & REXX
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Calling Assembler from REXX PL/I & Assembler 5
No new posts REXX/CLIST tool for BCSR and EDSR CLIST & REXX 2
No new posts Calling Rexx program from Cobol CLIST & REXX 12
No new posts REXX script to beautify XML CLIST & REXX 1
No new posts TWS PIF (EQQYCOM) Rexx - Occurrence S... IBM Tools 0

Back to Top