PDA

View Full Version : Stored procs from within CL and REXX?



Guest.Visitor
01-01-1995, 02:00 AM
I am reading the Advanced DB2/400 functionality redbook <font > color=red>(SG24-4249-01)</font>, and it casually mentions being able to execute a stored procedure from within a CL and/or a REXX proc. But I can't find any examples of this. Does anyone know where I might find some examples? Or does anyone have one? Just trying to keep up....

Guest.Visitor
05-07-1999, 09:34 AM
On Thursday, May 06, 1999, 08:23 PM, Ananth Raghuraman wrote: Hi, I have a Net.Data program (Net.data is similar to Perl), and in a DTW_SQL function called writeToTable(), I perform an INSERT INTO operation on a table. But I get an error saying I cannot perform the operation. I tried to get around it by giving *PUBLIC(everyone) the *RWX (read-write-execute) authority, but that doesn't work. If you have any ideas about this, please let me know. The following is the actual error message that was returned: NET.DATA DTW_SQL Error: Function writeToTable: The statement failed. T_RESUME in QGPL not valid for operation. SQLSTATE 55019, SQLCODE -7008 Ananth, As someone pointed out you are probably receiving this error because the file is not journaled. The reason code returned for SQL7008 (in qsqlmsg) identifies the cause of the error. The SQLSTATE 55019 just says you received SQL7008. I am not familiar enough with net.data to give you a definitive answer but if the file is not journaled and you will not benefit by journaling this file, you should be able to use the SET command to remove the journaling requirement. The command would be SET TRANSACTION ISOLATION LEVEL NO COMMIT. Another alternative may be to specify WITH NC on the insert. David Morris

Guest.Visitor
05-07-1999, 10:17 AM
On Friday, May 07, 1999, 08:49 AM, Jeff Importico wrote: I am reading the Advanced DB2/400 functionality redbook <font > color=red>(SG24-4249-01)</font>, and it casually mentions being able to execute a stored procedure from within a CL and/or a REXX proc. But I can't find any examples of this. Does anyone know where I might find some examples? Or does anyone have one? Just trying to keep up.... Jeff, Look at the SQL programming manual for examples. From CL you can use a query managment query to execute the call procedure sql statement in a source member. If you have multiple statements, remember to put the ; at the end of your statements. I have no experience using SQL in a REXX program but you should be able to use execute immediate to call the stored procedure. David Morris

Guest.Visitor
05-07-1999, 01:24 PM
I seem to remember having placed an example in the REXX forum. You have to be careful on the doc; to know whether they are talking about the specific language program being called as a stored procedure, or being able to call a stored procedure <my inference anyway, from dev comments when I asked my question about how the REXX stuff worked -- per my example -- everyone was talking about REXX being called as a stored procedure; I asked about SQL CALL from REXX>. Regards, Chuck Comments provided "as is" with no warranties of any kind whatsoever.

Guest.Visitor
05-07-1999, 05:57 PM
On Friday, May 07, 1999, 08:49 AM, Jeff Importico wrote: I am reading the Advanced DB2/400 functionality redbook <font > color=red>(SG24-4249-01)</font>, and it casually mentions being able to execute a stored procedure from within a CL and/or a REXX proc. But I can't find any examples of this. Does anyone know where I might find some examples? Or does anyone have one? Just trying to keep up.... <HR>it's real skimpy ,,, but try SC41-3612-01; under declare procedure....... <pre> <H4>Bob Hamilton TEXAS BUSINESS SYSTEMS 736 Pinehurst Richardson, Texas 75080 <h4> </pre></h4></h4>

Guest.Visitor
05-07-1999, 06:02 PM
On Friday, May 07, 1999, 10:17 AM, David Morris wrote: Jeff, Look at the SQL programming manual for examples. From CL you can use a query managment query to execute the call procedure sql statement in a source member. If you have multiple statements, remember to put the ; at the end of your statements. I have no experience using SQL in a REXX program but you should be able to use execute immediate to call the stored procedure. David Morris <HR>Almost any command you can execute from a CLP can be executed from REXX; enclose the command in double quotes.... If REXX can't make sense out of it, it goes to the command environment: OS/400, MVS, et c., even M$ Windows whatever....... <pre> <H4>Bob Hamilton TEXAS BUSINESS SYSTEMS 736 Pinehurst Richardson, Texas 75080 <h4> </pre></h4></h4>