Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / ODBC question

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. ODBC question
#12741
Posted by: Michael S 2009-03-06 21:53:01
on the mainframe, if I delete rows from a table based on a selection that isn't there (for example, delete from table where column = 1 and there are no rows with a value of 1 in column) I get a return code 100 (no rows found).

I'm trying to figure out how to do the same thing using Reginald. My code is as follows (this is just an example as I play with variations)

odbcerr = "ERROR"
odbcheading = 1

DO
	err = odbcexecute(delete_str)
	/* say 'Result from delete ***'result'***' */
	IF err <> "" THEN
		/* Something went wrong */
		rc = show_db2_error.rex(err)
	CATCH ERROR
		/* We come here ALSO if the row(s) to be deleted don't exist */
		err = CONDITION('D')
		IF err <> "" THEN
			DO
				/* There was a  REAL error */
				/* say 'Condition D from delete' */
				rc = show_db2_error.rex(err)
				rc = write_trace_progress("Delete DB2 row", rc)
				rc = 1
			END	
END

The call to ODBCExecute falls through on the CATCH ERROR, and condition('D') gives
"ODBCEXECUTE" reported ""
which in this case, isn't really an error. Is there no other way of catching that there were no rows other than looking at the value in err and accepting "ODBCEXECUTE" reported "" as a "non-error"
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0