Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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

Senior Member


Joined: 14 Mar 2007
Posts: 10535
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: 2110
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: 8735
Location: Welsh Wales

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

Senior Member


Joined: 14 Mar 2007
Posts: 10535
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 Will this code extract 1 byte from fi... pkmurali CLIST & REXX 8 Sat Nov 10, 2018 11:13 pm
No new posts Error reading file in REXX module ashek15 CLIST & REXX 3 Wed Oct 24, 2018 4:50 am
No new posts Encoding using rexx pkmurali CLIST & REXX 2 Sat Sep 08, 2018 1:05 am
No new posts Can we call QMF proc from REXX ? batu544 CLIST & REXX 6 Fri Aug 03, 2018 11:03 am
No new posts REXX CGI - Hello World vasanthz All Other Mainframe Topics 4 Fri Jul 13, 2018 3:53 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us